flink-cdc icon indicating copy to clipboard operation
flink-cdc copied to clipboard

[CDC2.0] Deserialization fails when restarting through checkpoint

Open findczk opened this issue 5 years ago • 8 comments

Some logs are as follows:
`2021-08-30 14:13:00 java.lang.RuntimeException: One or more fetchers have encountered exception at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager.checkErrors(SplitFetcherManager.java:199) at org.apache.flink.connector.base.source.reader.SourceReaderBase.getNextFetch(SourceReaderBase.java:154) at org.apache.flink.connector.base.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:116) at org.apache.flink.streaming.api.operators.SourceOperator.emitNext(SourceOperator.java:294) at org.apache.flink.streaming.runtime.io.StreamTaskSourceInput.emitNext(StreamTaskSourceInput.java:69) at org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:66) at org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:423) at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:204) at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:681) at org.apache.flink.streaming.runtime.tasks.StreamTask.executeInvoke(StreamTask.java:636) at org.apache.flink.streaming.runtime.tasks.StreamTask.runWithCleanUpOnFail(StreamTask.java:647) at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:620) at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:779) at org.apache.flink.runtime.taskmanager.Task.run(Task.java:566) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: SplitFetcher thread 0 received unexpected exception while polling the records at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:146) at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:101) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped. at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:42) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$ReaderThreadLifecycleListener.onEventDeserializationFailure(MySqlStreamingChangeEventSource.java:1189) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:958) at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:606) at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:850) ... 1 more Caused by: io.debezium.DebeziumException: Failed to deserialize data of EventHeaderV4{timestamp=1630288321000, eventType=EXT_DELETE_ROWS, serverId=211, headerLength=19, dataLength=37, nextPosition=351011882, flags=0} at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.wrap(MySqlStreamingChangeEventSource.java:1142) ... 5 more Caused by: com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializationException: Failed to deserialize data of EventHeaderV4{timestamp=1630288321000, eventType=EXT_DELETE_ROWS, serverId=211, headerLength=19, dataLength=37, nextPosition=351011882, flags=0} at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:309) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.nextEvent(EventDeserializer.java:232) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$1.nextEvent(MySqlStreamingChangeEventSource.java:233) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:945) ... 3 more Caused by: com.github.shyiko.mysql.binlog.event.deserialization.MissingTableMapEventException: No TableMapEventData has been found for table id:5108585. Usually that means that you have started reading binary log 'within the logical event group' (e.g. from WRITE_ROWS and not proceeding TABLE_MAP at com.github.shyiko.mysql.binlog.event.deserialization.AbstractRowsEventDataDeserializer.deserializeRow(AbstractRowsEventDataDeserializer.java:109) at com.github.shyiko.mysql.binlog.event.deserialization.DeleteRowsEventDataDeserializer.deserializeRows(DeleteRowsEventDataDeserializer.java:64) at com.github.shyiko.mysql.binlog.event.deserialization.DeleteRowsEventDataDeserializer.deserialize(DeleteRowsEventDataDeserializer.java:56) at com.github.shyiko.mysql.binlog.event.deserialization.DeleteRowsEventDataDeserializer.deserialize(DeleteRowsEventDataDeserializer.java:32) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:303) ... 6 more

`

findczk avatar Aug 26 '21 09:08 findczk

please check the binlog has been expored or not

leonardBang avatar Aug 26 '21 15:08 leonardBang

please check the binlog has been expored or not 你好,binlog是没有过期的,因为任务刚挂就马上从checkpoint重启了

findczk avatar Aug 27 '21 01:08 findczk

could you post your mysql version and the SQL ?

leonardBang avatar Aug 27 '21 02:08 leonardBang

could you post your mysql version and the SQL ?

mysql-version:5.7.20 ddl: CREATE TABLE dt_table_source ( idBIGINT, nameSTRING, birthdaySTRING, tsTIMESTAMP(3), update_time TIMESTAMP(3),tablename STRING METADATA FROM 'tablename',primary key (id) not enforced) WITH ( 'connector' = 'mysql-cdc', 'hostname' = 'xxx', 'port' = 'xxx', 'username' = 'gprp', 'password' = 'xxx', 'server-time-zone' = 'Asia/Shanghai', 'database-name' = 'chenzhikun_test', 'table-name' = 'dt_table_.*', 'server-id' = '5400-5401', 'connect.timeout' = '3600')

findczk avatar Aug 27 '21 03:08 findczk

could you post your mysql version and the SQL ?

Is there a plan to fix it? when?

findczk avatar Aug 27 '21 05:08 findczk

I didn't reproduce the case

leonardBang avatar Aug 27 '21 06:08 leonardBang

TABLE_MAP event is not happening before EXT_UPDATE_ROWS event type, that is the reason why we saw the "MissingTableMapEventException" exception. But I don’t know why TABLE_MAP event doesn’ happen before EXT_UPDATE_ROWS event. In the binlog file, the TABLE_MAP event is before theEXT_UPDATE_ROWS event image

findczk avatar Aug 30 '21 07:08 findczk

duplicate the #276, will fix in it

leonardBang avatar Aug 30 '21 08:08 leonardBang