New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBZ-5170 Mysql Commit Timestamp #3555
Conversation
Hi @harveyyue. Here is some information I found in binlog that maybe help you. The timestamps in Xid events have difference between auto-commit is enabled and disabled. Here is an example. If I execute SQLs as shown below. Then binlog file is as show below. So , the timestamps of transaction's Xid events maybe not ordered. The order of transaction's timestamp is very important, which can be used to judge the sequence of states. |
@jingtaozhang18, The session2 commit time (1654101009000) is less than session1 (1654101018000) according the mysql-binlog-connector parse the binlog event. Session 1: Session 2: Transaction (the sequence from transaction topic): {"status":"BEGIN","id":"file=mysql-bin.000030,pos=390084","event_count":null,"data_collections":null,"ts_ms":1654101009000} Data Event: {"before":{"test_avro_transaction.workdb.test_float.Value":{"id":1,"f1":{"float":16.0},"f2":{"double":90.56999969482422},"f3":{"double":30.123},"f4":{"double":123.456787109375},"f5_23":{"float":100.0},"f6_24":{"float":100.0},"f7":{"float":100.12}}},"after":{"test_avro_transaction.workdb.test_float.Value":{"id":1,"f1":{"float":18.0},"f2":{"double":90.56999969482422},"f3":{"double":30.123},"f4":{"double":123.456787109375},"f5_23":{"float":100.0},"f6_24":{"float":100.0},"f7":{"float":100.12}}},"source":{"version":"2.0.0-SNAPSHOT","connector":"mysql","name":"test_avro_transaction","ts_ms":1654101009000,"snapshot":{"string":"false"},"db":"workdb","sequence":null,"table":{"string":"test_float"},"server_id":112233,"gtid":null,"file":"mysql-bin.000030","pos":390242,"row":0,"thread":{"long":5968},"query":null},"op":"u","ts_ms":{"long":1654101018194},"transaction":{"io.confluent.connect.avro.ConnectDefault":{"id":"file=mysql-bin.000030,pos=390084","total_order":1,"data_collection_order":1}}} Binlog Event: 信息: Received Event{header=EventHeaderV4{timestamp=1654101009000, eventType=QUERY, serverId=112233, headerLength=19, dataLength=67, nextPosition=390170, currentPosition=390084, flags=8}, data=QueryEventData{threadId=5968, executionTime=9, errorCode=0, database='workdb', sql='BEGIN'}} |
Hi @harveyyue, the example you showed above is exactly what I was trying to say. And I think the timestamp of session 2 can't relfect the tranasaction commit time. The transaction commit time I understand is when the change of the transaction can be seen. Do you have any good idea to solve this problem? |
Regarding the binlog event data which I have posted, the session2 transaction commit time is 1654101009000, the session1 is 1654101018000, I think we just to consume the binlog data without any data changes. |
Yes, I think your current work is very meaningful. I also have no idea about this problem and I will learn more about the design philosophy of MySQL Binlog timestamp. If you have any ideas, please share with me, Thanks! |
@harveyyue @jingtaozhang18 Hi guys, when do we stand on this PR then? Does it provide the expected data albeit they might be a bit difficult to correctl interpret? |
Vitess pr: debezium/debezium-connector-vitess#83 |
@harveyyue Applied, thanks a lot! |
https://issues.redhat.com/browse/DBZ-5170
I will update to all connectors doc later.