frappe / event_streaming

Event Streaming for frappe
Other
28 stars 29 forks source link

Event Streaming: Error while Trying to Remove Child on the Consumer Site #11

Open landersaga opened 6 months ago

landersaga commented 6 months ago

Description of the issue

We have a document that exists on both producer and consumer site. The document consist 1 or more row of child table, the name of a row in a producer site is different with the one on the consumer site. When user deleted a row on the producer site, it caused error on the consumer site because the stream will search the child table document/row with the name from the producer site. This cause deleting of a child table row has to be done manuallly on the consumer site.

Output of bench version

5.20.0

Steps to reproduce the issue

  1. Prepare same document name (with child table) on the producer and consumer site (the creation must be done manually)
  2. Delete child table on the producer site

Observed result

Expected result

Child table removed from the document on the consumer site

Stacktrace / full error message

Traceback (most recent call last):
  File "apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py", line 279, in sync
    set_update(update, producer_site)
  File "apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py", line 331, in set_update
    local_doc = update_row_removed(local_doc, data.removed)
  File "apps/frappe/frappe/event_streaming/doctype/event_producer/event_producer.py", line 356, in update_row_removed
    table_rows.remove(child_table_row)
ValueError: list.remove(x): x not in list

Additional information

Frappe version: v14.62.4

karanwilson commented 6 months ago

Hi @landersaga , Is there any difference in table structure, or fieldnames of the doctype and the child-table being stream-synced? If yes, have you created a 'Mapping Configuration' for the child table of the doctype you are streaming? - please share the 'Mapping Configuration' for the doctype and it's child-table;

@nabinhait

landersaga commented 5 months ago

Hi @landersaga , Is there any difference in table structure, or fieldnames of the doctype and the child-table being stream-synced? If yes, have you created a 'Mapping Configuration' for the child table of the doctype you are streaming? - please share the 'Mapping Configuration' for the doctype and it's child-table;

@nabinhait

There is no difference in table structure. The mapping configuration is only set up for the parent doctype