异常:DataRowException, internal schema representation is probably out of sync with real database schema

1
2
3
4
5
6
7
8
9
起初异常信息打印的不全, 但是浑然不知,后来在打印信息里发现flink并没有打印出应该打印的日志,然后去查了下,是缺少依赖包包
加上
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<!-- 注意,若无type为jar则报错-->
<type>jar</type>
</dependency>

全部异常信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
ERROR io.debezium.relational.TableSchemaBuilder - Failed to properly convert data value for '<database>.<table>.<column>' of type BIGINT for row [xxx, [89, 75, 45, 71, 54, 50, 49, 51, 52], [], [], [], 2673560886446381824, 2673621569619875840, 2673621569770870784, 2673621569905088516, [], [], 999752586968682496, 2673547364245164544, 2022-01-26T16:31:54, 2673547364245164544, 2022-01-26T08:31:54Z]:
java.lang.IllegalArgumentException: Unexpected value for JDBC type -5 and column <column> BIGINT(20) NOT NULL: class=class java.time.ZonedDateTime
at io.debezium.jdbc.JdbcValueConverters.handleUnknownData(JdbcValueConverters.java:1248)
at io.debezium.jdbc.JdbcValueConverters.convertValue(JdbcValueConverters.java:1291)
at io.debezium.jdbc.JdbcValueConverters.convertBigInt(JdbcValueConverters.java:907)
at io.debezium.jdbc.JdbcValueConverters.lambda$converter$6(JdbcValueConverters.java:297)
at io.debezium.relational.TableSchemaBuilder.lambda$createValueGenerator$5(TableSchemaBuilder.java:264)
at io.debezium.relational.TableSchema.valueFromColumnData(TableSchema.java:141)
at io.debezium.relational.RelationalChangeRecordEmitter.emitUpdateRecord(RelationalChangeRecordEmitter.java:100)
at io.debezium.relational.RelationalChangeRecordEmitter.emitChangeRecords(RelationalChangeRecordEmitter.java:51)
at io.debezium.pipeline.EventDispatcher.dispatchDataChangeEvent(EventDispatcher.java:202)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$handleUpdate$5(MySqlStreamingChangeEventSource.java:692)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleChange(MySqlStreamingChangeEventSource.java:730)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleUpdate(MySqlStreamingChangeEventSource.java:691)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleEvent(MySqlStreamingChangeEventSource.java:352)
at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1118)
at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:966)
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:606)
at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:850)
at java.base/java.lang.Thread.run(Thread.java:834)
........
........
Caused by: org.apache.kafka.connect.errors.ConnectException: Error while processing event at offset {transaction_id=null, ts_sec=1643078923, file=mysql-bin.000769, pos=246091340, gtids=1672e567-02e6-11e9-9ea1-6c92bf62e60a:1-87,18a8602f-24a4-11e9-866f-6c92bf62e900:1-10282528,21027f69-24a4-11e9-921f-6c92bf629a62:1-88,39082d57-d67c-11e8-9425-6c92bf62e932:1-6,3edb8a51-c6dc-11eb-861a-b02628437d20:1-358377506:358377509-358377509:358377513-358377515:358377522-358377522:358377676-358377676:358377810-358377810,424930b8-d67c-11e8-9426-6c92bf6297dc:1-37,5cd2c98f-b4c7-11e9-93e3-18ded7a37b0a:1-91024726,5fcd5277-e4c1-11e8-840a-6c92bf6231d0:1-3421095,e629ea71-8992-11eb-8a85-b02628492540:1-40841167,ede3e888-2d9e-11eb-b086-0c42a1643055:1-41792663, row=1, server_id=210639, event=2}
at io.debezium.pipeline.EventDispatcher.dispatchDataChangeEvent(EventDispatcher.java:232)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$handleUpdate$5(MySqlStreamingChangeEventSource.java:692)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleChange(MySqlStreamingChangeEventSource.java:730)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleUpdate(MySqlStreamingChangeEventSource.java:691)
at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleEvent(MySqlStreamingChangeEventSource.java:352)
Caused by: org.apache.kafka.connect.errors.ConnectException: DataRowException, internal schema representation is probably out of sync with real database schema
at io.debezium.relational.TableSchemaBuilder.validateIncomingRowToInternalMetadata(TableSchemaBuilder.java:221)
at io.debezium.relational.TableSchemaBuilder.lambda$createValueGenerator$5(TableSchemaBuilder.java:250)
at io.debezium.relational.TableSchema.valueFromColumnData(TableSchema.java:141)
at io.debezium.relational.RelationalChangeRecordEmitter.emitUpdateRecord(RelationalChangeRecordEmitter.java:100)
at io.debezium.relational.RelationalChangeRecordEmitter.emitChangeRecords(RelationalChangeRecordEmitter.java:51)
at io.debezium.pipeline.EventDispatcher.dispatchDataChangeEvent(EventDispatcher.java:202)

问题解决步骤

  • 先从validateIncomingRowToInternalMetadata方法debug开始,一步步进行调试

发现获取当前表的字段数确实是比cdc捕捉到的数据多一个
再进入convertBigInt方法, data(因为column是updateTime,而data是个long类型数据)明显是不属于当前column的
再往下找没找到啥原因, 到这里只发现了问题

  • 去issue找问题

这条issue很有价值, 虽然和我们的并不是同一个问题

大概就是,我们可能需要去查看下binlog,看看是不是也有啥问题,按照这篇文章去导出binlog文件,结果真的查出来了问题

这里的格式解析出了问题,少了3,这也就解释了为什么我们上面为什么updateTime被解析到了long类型数值上面,因为错位了

之后的解决流程就是咨询云服务商然后解决的问题【mysql实例买的云服务】