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

MS SQL Update becomes delete+insert

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Unresolved
    • Major
    • under-triaging
    • 1.7.0.Final, 1.7.1.Final, 1.8.0.Alpha2
    • sqlserver-connector
    • None
    • False
    • False
    • 0
    • 0% 0%

    Description

      MS SQL "translates" some update statements to delete + insert in CDC . This means that for some updates, Kafka (rightfully) produces Delete, Null (if tombstone is enable) then Create events.
      This is described in https://docs.microsoft.com/en-US/troubleshoot/sql/replication/update-statements-replicated-as-delete-insert

      If you have a table with a unique index on the "name" column for example, if you issue

      update dbzClient set name = 'Client__1' where id = 1;
      

      the CDC table will record 2 events (operation 3 and 4) which is an update with respectively value before, value after - as I would expect.
      If now, you run

      update dbzClient set name = name + '__' where id < 3;
      

      which updates 2 rows for example, you'll have as expected 4 CDC entries in the table BUT the operation will be twice 1 (delete) followed by twice 2 (insert)!
      And this despite there is a FK that reference those records.

      Attachments

        Activity

          People

            Unassigned Unassigned
            thierry@avanco.be Thierry De Leeuw (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: