Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-150

Update DBZ events order from CREATE/DELETE to DELETE/CREATE in case if primary column(s) get changed

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 0.3.5, 0.4
    • 0.3.4
    • mysql-connector
    • None

      Currently when primary column (or partial column from composite PK) changes via an UPDATE statement, Debezium creates two events in following order: a CREATE with the new key and DELETE with the old key. This is OK, because the message keys are different, so compaction (and stuff like that) won't result in data loss. But, in cases when actual table's primary key is artificial (in our case composite primary key stands just for keeping physical records in needed order – order by optimization) and there is another real primary key (represented as unique index) that is immutable and used everywhere. So, in this case Debeziums PK (that is derived from MySQL PK) doesn't correspond to real (immutable identifier) and CREATE/DELETE events simply wipe out data permanently.

      Please, change order of originated Debezium events from CREATE->DELETE to DELETE->CREATE so downstream consumers won't erase data for database update actions.

              rhauch Randall Hauch (Inactive)
              anton_nazaruk Anton Nazaruk (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: