This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
syncer: fix the gtid purged error when switching pos replication to gtid (#2094) #2104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #2094
What problem does this PR solve?
Fix #1814
In #1723 we support switching position replication to gtid replication by combining previous GTID sets and their events in binlog files. However, if there are some gtid events that are purged, the switching progress will fail.
What is changed and how it works?
According to MySQL's official document 1
and MySQL's official document 2
Gsets of
gtid_purged
are not in any binlog files but they are contained ingtid_executed
. This can explain two things:gtid_purged
, even if we continue the way of position replication.gtid_executed
won't make the situation better. Upstream MySQL may still purge binlogs when we trying to catch events togtid_executed
.So we can directly add
gtid_purged
in adjusted gtid sets to avoid MySQL error.Check List
Tests
Use a slave MySQL whose previous gtids starts from 5 to test whether this PR works.
Related changes