How to use TRANSACTION_CONTEXT_EVENT for the replication
zhanghaiyang9999 opened this issue · 2 comments
zhanghaiyang9999 commented
When using the following code, how to detect what's is the transaction begin(if a transaction has multiple operations) ? is the TRANSACTION_CONTEXT_EVENT ? thanks!
streamer, err := syncer.StartSync(pos)
contx, cancel := context.WithTimeout(context.Background(), time.Second)
ev, err := streamer.GetEvent(contx)
lance6716 commented
it depends on your mysql version. you can dump every events to log and find the pattern. for some mysql version, I remember there are "BEGIN" query events for each transaction.
cameron-p-m commented
If you have GTID enabled, GTID_event is the beginning of the transaction and Xid_event is the end of the transaction.