actiontech/dtle

handle query_event COMMIT

c0494133d4 opened this issue · 2 comments

#1059 中出现了 query_event query="COMMIT" 的情况

[WARN] reader: mysql.reader: QueryEvent is not recognized. will still execute: job=dtle-track query=COMMIT gno=89248399

原场景(RDS 5.6)未能复现.

但发现如下case可触发

set gtid_next = 'some_uuid:some_gno';
begin;
commit;
-- binlog中形成query_event BEGIN 和 COMMIT的空事务

需验证dtle能否处理此场景及后续复制.

已知在gtid_next='automatic'时, 空事务不会写入binlog.

dtle 行为

未识别query, 但放行至目标端
    2023-06-28T10:47:33.942+0800 [WARN]  client.driver_mgr.dtle: mysql.reader: QueryEvent is not recognized. will still execute: driver=dtle gno=5 job=a1 query=COMMIT @module=reader timestamp="2023-06-28T10:47:33.942+0800"
目标端执行COMMIT query (非dtle固有的提交流程)
    2023-06-28T10:47:33.942+0800 [DEBUG] client.driver_mgr.dtle: execQuery: driver=dtle @module=dtle.applier job=a1 query="COMMIT /*dtle_gtid1 a1 00003307-1111-1111-1111-111111111112 5 dtle_gtid*/" timestamp="2023-06-28T10:47:33.942+0800"
dtle 写入gtid_executed
    2023-06-28T10:47:33.955+0800 [DEBUG] client.driver_mgr.dtle: insert gno: driver=dtle gno=5 job=a1 rows=0 @module=dtle.applier.ApplyBinlogEvent timestamp="2023-06-28T10:47:33.955+0800"
dtle提交(固有流程)
    2023-06-28T10:47:33.970+0800 [DEBUG] client.driver_mgr.dtle: applier tx committed: driver=dtle gno=5 job=a1 rows=0 @module=dtle.applier.ApplyBinlogEvent timestamp="2023-06-28T10:47:33.969+0800"

后续复制正常执行.

一般DML事务和DDL事务都不会出现query_event COMMIT. 该场景产生原因及影响仍不明.

9db0c33: 不再提示not recognized, 而是提示:

[WARN]  client.driver_mgr.dtle: found query_event COMMIT. Please report the case at #1062: driver=dtle @module=reader gno=6 job=a1 timestamp="2023-06-28T16:09:35.321+0800"