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

Default value for datetime(0) is incorrectly handled

    XMLWordPrintable

    Details

      Description

      A report from the user says that
      ALTER TABLE user.t_user_black_list MODIFY COLUMN update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'update_time' AFTER create_time;

      fails with exception

      {"name":"debezium-mysql-source-dev2","connector":{"state":"RUNNING","worker_id":"172.31.9.247:8083"},"tasks":[{"state":"FAILED","trace":"org.apache.kafka.connect.errors.ConnectException: Maximum width must be from 1 to 9 inclusive but was 0\n\tat io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)\n\tat io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:208)\n\tat io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:508)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1095)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:943)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:580)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:825)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: java.lang.IllegalArgumentException: Maximum width must be from 1 to 9 inclusive but was 0\n\tat java.time.format.DateTimeFormatterBuilder$FractionPrinterParser.<init>(DateTimeFormatterBuilder.java:2922)\n\tat java.time.format.DateTimeFormatterBuilder.appendFraction(DateTimeFormatterBuilder.java:687)\n\tat io.debezium.connector.mysql.MySqlDefaultValuePreConverter.timestampFormat(MySqlDefaultValuePreConverter.java:239)\n\tat io.debezium.connector.mysql.MySqlDefaultValuePreConverter.convertToLocalDateTime(MySqlDefaultValuePreConverter.java:129)\n\tat io.debezium.connector.mysql.MySqlDefaultValuePreConverter.convert(MySqlDefaultValuePreConverter.java:68)\n\tat io.debezium.connector.mysql.antlr.listener.ColumnDefinitionParserListener.convertDefaultValueToSchemaType(ColumnDefinitionParserListener.java:303)\n\tat io.debezium.connector.mysql.antlr.listener.ColumnDefinitionParserListener.enterDefaultValue(ColumnDefinitionParserListener.java:142)\n\tat io.debezium.ddl.parser.mysql.generated.MySqlParser$DefaultValueContext.enterRule(MySqlParser.java:46698)\n\tat io.debezium.antlr.ProxyParseTreeListenerUtil.delegateEnterRule(ProxyParseTreeListenerUtil.java:46)\n\tat io.debezium.connector.mysql.antlr.listener.MySqlAntlrDdlParserListener.enterEveryRule(MySqlAntlrDdlParserListener.java:89)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.enterRule(ParseTreeWalker.java:41)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:25)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)\n\tat io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:85)\n\tat io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:307)\n\tat io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:694)\n\tat io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:492)\n\t... 5 more\n","id":0,"worker_id":"172.31.9.247:8083"}],"type":"source"}
      

      The problem is probably with MySqlDefaultValuePreConverter.timestampFormat as it should not use fractions for zero length field.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ccranfor Chris Cranford
                Reporter:
                jpechanec Jiri Pechanec
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: