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

CDC Event Schema Doesn't Change After 2 Fields Switch Names and Places

    Details

    • Type: Bug
    • Status: Pull Request Sent (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 0.10.0.Final
    • Fix Version/s: 1.1-next
    • Component/s: mysql-connector
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      MySQL docker image: percona:5.7

      CREATE TABLE `test_table` (
        `c1` int NOT NULL,
        `c2` int NOT NULL,
        `c3` int NOT NULL
      );
      -- Insert some data, Debezium CDC event has schema v1
      INSERT INTO `test_table` (`c1`, `c2`, `c3`)
      VALUES ('1', '11', '111');
      
      -- Switch 2 columns names and places
      ALTER TABLE `test_table`
      CHANGE `c3` `c3_temp` int(11) NOT NULL AFTER `c1`,
      CHANGE `c2` `c2_temp` int(11) NOT NULL AFTER `c3_temp`;
      
      ALTER TABLE `test_table`
      CHANGE `c3_temp` `c2` int(11) NOT NULL AFTER `c1`,
      CHANGE `c2_temp` `c3` int(11) NOT NULL AFTER `c2`;
      
      -- Insert some data, but Debezium CDC event still has schema v1
      INSERT INTO `test_table` (`c1`, `c2`, `c3`)
      VALUES ('2', '22', '222');
      
      
      Show
      MySQL docker image: percona:5.7 CREATE TABLE `test_table` ( `c1` int NOT NULL , `c2` int NOT NULL , `c3` int NOT NULL ); -- Insert some data , Debezium CDC event has schema v1 INSERT INTO `test_table` (`c1`, `c2`, `c3`) VALUES ( '1' , '11' , '111' ); -- Switch 2 columns names and places ALTER TABLE `test_table` CHANGE `c3` `c3_temp` int (11) NOT NULL AFTER `c1`, CHANGE `c2` `c2_temp` int (11) NOT NULL AFTER `c3_temp`; ALTER TABLE `test_table` CHANGE `c3_temp` `c2` int (11) NOT NULL AFTER `c1`, CHANGE `c2_temp` `c3` int (11) NOT NULL AFTER `c2`; -- Insert some data , but Debezium CDC event still has schema v1 INSERT INTO `test_table` (`c1`, `c2`, `c3`) VALUES ( '2' , '22' , '222' );

      Description

      In MySQL, between 2 CDC events, if the table has 2 columns renamed and switched positions, the CDC events will have the same schema before and after the schema change.

      In the attachments are the CDC events before and after schema changes.

        Gliffy Diagrams

          Attachments

          1. after.json
            4 kB
          2. before.json
            4 kB

            Activity

              People

              • Assignee:
                jpechanec Jiri Pechanec
                Reporter:
                jasontsao0411 Jason Tsao
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: