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

Integer column with negative default value causes MySQL connector to crash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 0.6.2
    • 0.6.1
    • mysql-connector
    • None
    • Hide

      Attempt to sync any table that has an integer column with a default value of a negative number.

      Show
      Attempt to sync any table that has an integer column with a default value of a negative number.

      Attempt to connect a table with an integer column with a default value of -1 (or any negative number) results in the following:

      org.apache.kafka.connect.errors.ConnectException: Expecting integer at line 6, column 47 but found '-'
      	at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:164)
      	at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:142)
      	at io.debezium.connector.mysql.SnapshotReader.execute(SnapshotReader.java:577)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: io.debezium.text.ParsingException: Expecting integer at line 6, column 47 but found '-'
      	at io.debezium.text.TokenStream.consumeInteger(TokenStream.java:583)
      	at io.debezium.relational.ddl.DdlParser.parseNumericLiteral(DdlParser.java:754)
      	at io.debezium.relational.ddl.DdlParser.parseLiteral(DdlParser.java:744)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseDefaultClause(MySqlDdlParser.java:1600)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseColumnDefinition(MySqlDdlParser.java:855)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseCreateColumn(MySqlDdlParser.java:724)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseCreateDefinition(MySqlDdlParser.java:702)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseCreateDefinitionList(MySqlDdlParser.java:561)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseCreateTable(MySqlDdlParser.java:378)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseCreate(MySqlDdlParser.java:281)
      	at io.debezium.connector.mysql.MySqlDdlParser.parseNextStatement(MySqlDdlParser.java:152)
      	at io.debezium.relational.ddl.DdlParser.parse(DdlParser.java:286)
      	at io.debezium.relational.ddl.DdlParser.parse(DdlParser.java:267)
      	at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:354)
      	at io.debezium.connector.mysql.SnapshotReader.lambda$execute$9(SnapshotReader.java:341)
      	at io.debezium.jdbc.JdbcConnection.query(JdbcConnection.java:389)
      	at io.debezium.jdbc.JdbcConnection.query(JdbcConnection.java:344)
      	at io.debezium.connector.mysql.SnapshotReader.execute(SnapshotReader.java:339)
      

      The first line in the above stack trace will vary depending on what line and column the negative number is defined in the CREATE TABLE statement generated by the connector.

      This may not be limited to just the mysql connector as it appears the error occurs somewhere in TokenStream.java https://github.com/debezium/debezium/blob/master/debezium-core/src/main/java/io/debezium/text/TokenStream.java#L583

      It appears that the hyphen is being recognized as a special symbol and parsing is being stopped before extracting the actual integer value, but I am rather unfamiliar with this code base.

              jpechane Jiri Pechanec
              smclenithan Steve McLenithan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: