GTID 3/5: Binlog streaming start/stop (behind mode flag)#447
Open
driv3r wants to merge 4 commits into
Open
Conversation
driv3r
force-pushed
the
gtid-stage3-streamer
branch
from
July 22, 2026 00:17
7d3a39d to
4abcb71
Compare
Wire the GTID coordinate mode into BinlogStreamer so a fresh run can stream from and stop at a GTID set, while file/position stays the default and unchanged. - BinlogStreamer gains BinlogCoordinateMode plus GTID tracking of the streamed, resumable, and stop GTID sets. - Add ConnectBinlogStreamerToMysqlWithCoordinate and ...FromCoordinate that dispatch to StartSync (file/pos) or StartSyncGTID (gtid), with coordinate-type validation. - Track committed GTID via XIDEvent.GSet and record the pre-transaction set as the resumable point at GTIDEvent; clone to avoid aliasing go-mysql's mutable set. - Replace the Run loop stop condition with shouldContinueStreaming, which uses position compare for file/pos and executed-set containment for GTID. FlushAndStop records the GTID stop set. - Ferry passes the mode to its streamers and uses coordinate-based connect/state updates. GTID resume-from-state is explicitly rejected until GTID state persistence lands. - Add internal unit tests for mode dispatch, stop logic, and validation. File/position behavior is unchanged; GTID streaming works for fresh runs. GTID resume and verifier/progress/replica-catchup wiring follow in later stages.
shouldContinueStreaming no longer branches on coordinate type: it asks GetLastStreamedBinlogCoordinate().HasReached(GetStopBinlogCoordinate()), delegating the file/position-vs-GTID mechanics to BinlogCoordinate. Add GetStopBinlogCoordinate so both the streamed and stop roles are exposed as coordinates. A zero stop coordinate means "no target recorded yet", matching the previous guard.
"From" read too much like the "With" (start-from-current) variant. "Since" makes it clear the streamer starts since the given coordinate.
- shouldContinueStreaming no longer treats an empty stop coordinate as "unset". FlushAndStop always records the stop target before setting stopRequested, so an empty executed GTID set on a fresh source is a valid target that is immediately reached, rather than hanging cutover. - Advance the streamed GTID set on DDL/admin QueryEvents (which commit without an XIDEvent), skipping transaction-control statements (BEGIN). Previously a cutover whose stop target ended in a DDL could hang. - Validate @@GLOBAL.gtid_mode=ON for the source (and target when target verification is enabled) during Ferry.Initialize when in GTID mode, so misconfiguration fails fast instead of late during streaming. - Add unit tests for the empty stop target, QueryEvent advancement, and transaction-control detection.
driv3r
force-pushed
the
gtid-stage3-streamer
branch
from
July 22, 2026 19:00
2132529 to
e3d40fb
Compare
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 3 of 5 — GTID support
Base: #446. Review/merge in stack order.
What this PR does
Wires the GTID coordinate mode into
BinlogStreamerso a fresh run can stream from and stop at a GTID set, while file/position stays the default and unchanged.BinlogStreamergainsBinlogCoordinateModeplus GTID tracking of the streamed, resumable, and stop GTID sets.ConnectBinlogStreamerToMysqlWithCoordinate/...FromCoordinatedispatch toStartSync(file/pos) orStartSyncGTID(gtid), with coordinate-type validation.XIDEvent.GSet; records the pre-transaction set as the resumable point atGTIDEvent(clone to avoid aliasing go-mysql's mutable set).shouldContinueStreaming(position compare for file/pos, executed-set containment for GTID).FlushAndStoprecords the GTID stop set.File/position behavior is unchanged; GTID streaming works for fresh runs.