debezium 0.8.0 mysql连接器解析binlog失败,table.columnWithName返回null,为什么会这样?

时间:2018-08-08 01:40:00

标签: mysql apache-kafka connect binlog debezium

当有人通过IDEA修改表时,由于NullPointerException,debezium连接器任务失败。

这是kafka连接日志:

INFO: Connected to 192.168.1.204:3306 at mysql-bin.000098/467648 (sid:184054, cid:59755)
[2018-08-07 19:05:15,309] INFO Connected to MySQL binlog at 192.168.1.204:3306, starting at binlog file 'mysql-bin.000098', pos=467648, skipping 2 events plus 0 rows (    io.debezium.connector.mysql.BinlogReader:941)
[2018-08-07 19:05:15,309] INFO WorkerSourceTask{id=debezium-mysql-source-dev-0} Source task finished initialization and start (org.apache.kafka.connect.runtime.WorkerSourceTask:165)
[2018-08-07 19:05:15,311] INFO Creating thread debezium-mysqlconnector-dev-binlog-client (io.debezium.util.Threads:247)
[2018-08-07 19:05:15,364] INFO Cluster ID: rse1l3gPRJW9-aJLJMB8YA (org.apache.kafka.clients.Metadata:265)
[2018-08-07 19:05:15,370] ERROR Error during binlog processing. Last offset stored = null, binlog reader near position = mysql-bin.000098/467713 (    io.debezium.connector.mysql.BinlogReader:967)
[2018-08-07 19:05:15,371] ERROR Failed due to error: Error processing binlog event (io.debezium.connector.mysql.BinlogReader:179)
org.apache.kafka.connect.errors.ConnectException: Unexpected exception while parsing statement /* ApplicationName=IntelliJ IDEA 2017.2.4 */ ALTER TABLE fund_account ALTER COLUMN     is_use_pay SET DEFAULT 0 at line 1, column 99
        at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:200)
        at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:178)
        at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:452)
        at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1055)
        at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:913)
        at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:559)
        at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:793)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.debezium.text.ParsingException: Unexpected exception while parsing statement /* ApplicationName=IntelliJ IDEA 2017.2.4 */ ALTER TABLE fund_account ALTER COLUMN     is_use_pay SET DEFAULT 0 at line 1, column 99
        at io.debezium.relational.ddl.LegacyDdlParser.parsingFailed(LegacyDdlParser.java:555)
        at io.debezium.relational.ddl.LegacyDdlParser.parse(LegacyDdlParser.java:227)
        at io.debezium.relational.ddl.LegacyDdlParser.parse(LegacyDdlParser.java:200)
        at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:298)
        at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:637)
        at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:436)
        ... 5 more
Caused by: java.lang.NullPointerException
        at io.debezium.connector.mysql.MySqlDdlParser.parseAlterSpecification(MySqlDdlParser.java:1296)
        at io.debezium.connector.mysql.MySqlDdlParser.parseAlterSpecificationList(MySqlDdlParser.java:1254)
        at io.debezium.connector.mysql.MySqlDdlParser.parseAlterTable(MySqlDdlParser.java:1237)
        at io.debezium.connector.mysql.MySqlDdlParser.parseAlter(MySqlDdlParser.java:1199)
        at io.debezium.connector.mysql.MySqlDdlParser.parseNextStatement(MySqlDdlParser.java:177)
        at io.debezium.relational.ddl.LegacyDdlParser.parse(LegacyDdlParser.java:219)
        ... 9 more
[2018-08-07 19:05:15,373] INFO Error processing binlog event, and propagating to Kafka Connect so it stops this connector. Future binlog events read before connector is shutdown will     be ignored. (io.debezium.connector.mysql.BinlogReader:457)

这是mysql binlog:

/*!\C utf8mb4 *//*!*/;
SET@@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=224/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
/* ApplicationName=IntelliJ IDEA 2017.2.4 */ ALTER TABLE fund_account 
ALTER COLUMN is_use_pay SET DEFAULT 0
/*!*/;
# at 467906
#180806 12:26:09 server id 1  end_log_pos 467971 CRC32 0x28ebc3fa    
Anonymous_GTID  last_committed=833  sequence_number=834 rbr_only=yes
/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/;
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 467971

看来debezium无法解析ALTER TABLE fund_account ALTER COLUMN is_use_pay SET DEFAULT 0

1 个答案:

答案 0 :(得分:0)

有趣,您能从IDEA以外的其他部门尝试吗?

您还可以尝试使用设置为ddl.parser.mode的{​​{1}}吗?

如果问题仍然存在,能否请您在Jira项目中提出问题?

谢谢