【报错详情】
ERROR io.debezium.connector.mysql.BinlogReader [] - Encountered change event 'Event{header=EventHeaderV4{timestamp=xxx, eventType=TABLE_MAP, serverId=xxx, headerLength=xxx, dataLength=xxx, nextPosition=xxx, flags=xxx}, data=TableMapEventData{tableId=xxx, database='xxx', table='xxx', columnTypes=xxx, xxx..., columnMetadata=xxx,xxx..., columnNullability={xxx,xxx...}, eventMetadata=null}}' at offset {ts_sec=xxx, file=mysql-bin.xxx, pos=xxx, gtids=xxx, server_id=xxx, event=xxx} for table xxx.xxx whose schema isn't known to this connector. One possible cause is an incomplete database history topic. Take a new snapshot in this case.
Use the mysqlbinlog tool to view the problematic event: mysqlbinlog --start-position=30946 --stop-position=31028 --verbose mysql-bin.004419
202x-xx-xx xx:xx:xx,xxx ERROR io.debezium.connector.mysql.BinlogReader [] - Error during binlog processing. Last offset stored = null, binlog reader near position = mysql-bin.xxx/xxx
202x-xx-xx xx:xx:xx,xxx ERROR io.debezium.connector.mysql.BinlogReader [] - Failed due to error: Error processing binlog event
org.apache.kafka.connect.errors.ConnectException: Encountered change event for table statistic.apk_info whose schema isn't known to this connector
at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:241) ~[ververica-connector-mysql-1.12-vvr-3.0.0-SNAPSHOT-jar-with-dependencies.jar:1.12-vvr-3.0.0-SNAPSHOT]
at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:218) ~[ververica-connector-mysql-1.12-vvr-3.0.0-SNAPSHOT-jar-with-dependencies.jar:1.12-vvr-3.0.0-SNAPSHOT]。
【报错原因】
当作业中使用的某些数据库,没有其对应的某些权限时,可能出现该错误。
当使用了'debezium.snapshot.mode'='never'时,可能出现该错误。因为这会导致从Binlog开头读取数据,但是Binlog开头的变更事件对应的Table Schema和当前表的Schema可能不匹配,所以会报该错误。
遇到Debezium解析不了的变更,例如Debezium无法解析`DEFAULT (now())`,可能出现该错误。
【解决方案】
先确认使用的数据库用户是否有对应作业中全部数据库的相应权限,详细赋权操作请参见。
不建议使用'debezium.snapshot.mode'='never',可以通过'debezium.inconsistent.schema.handling.mode' = 'warn'参数绕过。
继续观察日志,查询io.debezium.connector.mysql.MySqlSchema WARN的log,会打印出具体无法解析的变更是什么,例如Debezium解析不了 `DEFAULT (now())`。