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

MySql connector fails after CREATE TABLE IF NOT EXISTS table_A, given table_A does exist already

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.0.CR1
    • 1.0.0.Final, 1.1.0.Beta1, 1.1.0.Beta2
    • mysql-connector
    • None

      Issuing a "create table if not exists" statement with name of a table that already exists incorrectly updates Debezium internal state.

      Create MySql Debezium connector worker and attach it to some DB.

      create table inventory.record
      (
          id bigint auto_increment
              primary key,
          field decimal(12,4) null
      );
      insert into inventory.record(id, field) values(5, -100.0001);
      

      All works fine. Next execute (important here is that schema is different from already existing one):

      create table if not exists inventory.record
      (
          id bigint auto_increment
              primary key,
          field decimal(12,4) null,
          field2 decimal(12,4) null
      );
      

      Connector is still up and alive.
      Next execute:

      insert into inventory.record(id, field) values(8, 12345678.9999);
      

      Connector will fail with following error:

      org.apache.kafka.connect.errors.ConnectException: The binlog event does not contain expected number of columns; the internal schema representation is probably out of sync with the real database schema, or the binlog contains events recorded with binlog_row_image other than FULL or the table in question is an NDB table
      	at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)
      	at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:207)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:536)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1095)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:943)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:580)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:825)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.kafka.connect.errors.ConnectException: The binlog event does not contain expected number of columns; the internal schema representation is probably out of sync with the real database schema, or the binlog contains events recorded with binlog_row_image other than FULL or the table in question is an NDB table
      	at io.debezium.connector.mysql.RecordMakers$1.validateColumnCount(RecordMakers.java:353)
      	at io.debezium.connector.mysql.RecordMakers$1.insert(RecordMakers.java:246)
      	at io.debezium.connector.mysql.RecordMakers$RecordsForTable.create(RecordMakers.java:471)
      	at io.debezium.connector.mysql.BinlogReader.handleInsert(BinlogReader.java:860)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:519)
      	... 5 more
      

              Unassigned Unassigned
              rgibaiev Ruslan Gibaiev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: