GTID 5/5: GTID-aware replica catchup#449
Open
driv3r wants to merge 4 commits into
Open
Conversation
driv3r
force-pushed
the
gtid-stage4-state-resume
branch
from
July 22, 2026 00:17
51a31ee to
5e4845c
Compare
driv3r
force-pushed
the
gtid-stage5-replica-progress
branch
from
July 22, 2026 00:17
1fe1cb0 to
183b91b
Compare
driv3r
force-pushed
the
gtid-stage4-state-resume
branch
from
July 22, 2026 13:50
5e4845c to
aa1df3b
Compare
driv3r
force-pushed
the
gtid-stage5-replica-progress
branch
from
July 22, 2026 13:50
183b91b to
c4cbc01
Compare
Make WaitUntilReplicaIsCaughtUpToMaster coordinate-mode aware so running from a replica works in GTID mode, using executed-set containment instead of file/position ordering. - Add ReplicatedMasterCoordinateFetcher + ReplicatedMasterGTIDViaCustomQuery, and IsCaughtUpToCoordinate (GTID containment / file-pos compare). The legacy file/position fetcher and IsCaughtUp API are preserved via an adapter. - Ferry passes BinlogCoordinateMode to the wait object; the init probe uses a mode-appropriate coordinate. - copydb and sharding gain ReplicatedMasterGTIDQuery and select the GTID fetcher in GTID mode. - Tests: GTID replica-catchup suite; replication-config and master-change tests made mode-aware. Verified locally on MySQL 8.0: full Go and Ruby suites pass in both file_position and gtid modes.
IsCaughtUpToCoordinate no longer branches on coordinate type; it asks current.HasReached(targetMaster), delegating file/position-vs-GTID mechanics to BinlogCoordinate.
- copydb and sharding now reject an empty ReplicatedMasterGTIDQuery (and copydb an empty ReplicatedMasterPositionQuery) when running from a replica, failing at init instead of late at the first probe. - When in GTID mode, validate @@GLOBAL.gtid_mode=ON on the source replication master, since its executed GTID set is the cutover target.
The config comment predated GTID streaming/state/resume/replica wiring and claimed streaming still used file/position. Describe the actual shipped behavior, the gtid_mode requirements, and that legacy file/position progress fields are not populated in GTID mode (use the coordinate fields instead).
driv3r
force-pushed
the
gtid-stage4-state-resume
branch
from
July 22, 2026 19:00
aa1df3b to
53678c2
Compare
driv3r
force-pushed
the
gtid-stage5-replica-progress
branch
from
July 22, 2026 19:00
c4cbc01 to
a00df91
Compare
Contributor
Author
Review follow-ups addressed (stack-wide)Aggregated the three reviews and pushed fixes to the relevant stage branches (rebased through the stack). Summary: #447 (
#446 (
#448 (
#449 (
Added tests: empty stop target, QueryEvent advancement, transaction-control detection, Validation (MySQL 8.0.32): full Go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked PR 5 of 5 — GTID support
Base: #448. Final PR in the stack.
What this PR does
Makes
WaitUntilReplicaIsCaughtUpToMastercoordinate-mode aware so running Ghostferry from a replica works in GTID mode, using executed-set containment instead of file/position ordering.ReplicatedMasterCoordinateFetcher+ReplicatedMasterGTIDViaCustomQuery, andIsCaughtUpToCoordinate(GTID containment / file-pos compare). The legacy file/position fetcher andIsCaughtUpAPI are preserved via an adapter.BinlogCoordinateModeto the wait object; the init probe uses a mode-appropriate coordinate.ReplicatedMasterGTIDQueryand select the GTID fetcher in GTID mode.Verified locally on MySQL 8.0: full Go and Ruby suites pass in both
file_positionandgtidmodes.Whole-stack validation summary
test/go: pass in both modes;copydb/test+sharding/testpass.file_position73 tests/650 assertions,gtid73 tests/651 assertions — 0 failures.