Skip to content
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

How to use TRANSACTION_CONTEXT_EVENT for the replication #857

Open
zhanghaiyang9999 opened this issue Apr 17, 2024 · 2 comments
Open

How to use TRANSACTION_CONTEXT_EVENT for the replication #857

zhanghaiyang9999 opened this issue Apr 17, 2024 · 2 comments

Comments

@zhanghaiyang9999
Copy link

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
Copy link
Collaborator

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
Copy link
Contributor

If you have GTID enabled, GTID_event is the beginning of the transaction and Xid_event is the end of the transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants