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

BOOLEAN datatype snapshot vs. binlog parsing inconsistency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 0.8.3.Final
    • mysql-connector
    • None
    • Hide
      • Create a table with a BOOLEAN column (CREATE TABLE test (isFoo BOOLEAN))
      • Start mysql-connector
      • Note that int16 is registered as the type in the SR for column "isFoo"
      • Delete table test
      • Create table test with the same definition while the connector is still running
      • Insert data into table test
      • Note that the connector registers "boolean" for "isFoo" as opposed to int16
      Show
      Create a table with a BOOLEAN column (CREATE TABLE test (isFoo BOOLEAN)) Start mysql-connector Note that int16 is registered as the type in the SR for column "isFoo" Delete table test Create table test with the same definition while the connector is still running Insert data into table test Note that the connector registers "boolean" for "isFoo" as opposed to int16

      I think it's possible I may have run into a bug similar to DBZ-615.

      If you create a table in MySQL with a column type of BOOLEAN it ends up as TinyInt(1). If you then start a MySQL connector pointed at that table it will register a schema with a type of "int" and "connect.type" of "int16" with the Schema Registry during the snapshot. If however, you then drop and then recreate that table with the same schema and insert some data the connector will register a new schema with type "boolean" in the Schema Registry.

      When the mysql connector encounters this situation it should register either int16 or boolean every time. I think the issue is that the connector is able to rightly map "BOOLEAN" from the CREATE statement to a boolean in the Schema Registry, but is forced to treat the TinyInt(1) it sees during a snapshot as if it could hold more than 1 bit of data.

      I think the easiest solution might be to map BOOLEAN values to Types.SMALLINT in the ddl parser, but I don't really like what that means for consumers.

              Unassigned Unassigned
              cliffwheadon Clifford Wheadon (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: