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

GTID replication pointer issue #132

Open
srakhmanchuk opened this issue Feb 18, 2025 · 1 comment
Open

GTID replication pointer issue #132

srakhmanchuk opened this issue Feb 18, 2025 · 1 comment

Comments

@srakhmanchuk
Copy link

srakhmanchuk commented Feb 18, 2025

Hi! I’ve noticed unexpected behavior when relying on GTID as a replication pointer.

Assume MySQL has executed the following transactions:

b1988e6b-e20e-11ee-916d-0242ac350008:1
b1988e6b-e20e-11ee-916d-0242ac350008:2
b1988e6b-e20e-11ee-916d-0242ac350008:3
b1988e6b-e20e-11ee-916d-0242ac350008:4
...
b1988e6b-e20e-11ee-916d-0242ac350008:300

Upon connection, the script informs the master node that the latest processed transaction is: b1988e6b-e20e-11ee-916d-0242ac350008:300. However, for some reason, MySQL continues to send past transactions (1,2,3,4 ... ), leading to event data duplication.

What could be causing this issue?

@srakhmanchuk
Copy link
Author

More details:

I’m storing GTID b1988e6b-e20e-11ee-916d-0242ac350008:300. I start a connection and pass this GTID to the server. MySQL sends transaction b1988e6b-e20e-11ee-916d-0242ac350008:300 to the script. Since this is the latest transaction it processed, the script ignores it.

However, for some reason, MySQL then sends a very old GTID: b1988e6b-e20e-11ee-916d-0242ac350008:1. My script now stores this GTID and resumes using it on the next restart.

Seems like MySQL interprets GTID as a single transaction instead of a range
I'm storing only b1988e6b-e20e-11ee-916d-0242ac350008:300, but MySQL expects the full GTID set (1-300).
When I reconnect, MySQL does not see 1-299 as executed, so it resends them.

Maybe instead of passing only the last GTID, the lib should create the range of executed GTID set and pass it upon connection?

Stored GTID: b1988e6b-e20e-11ee-916d-0242ac350008:300
Final GTID passed to MYSQL: b1988e6b-e20e-11ee-916d-0242ac350008:1-300

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

1 participant