GTID 2/5: Add coordinate mode (representation + config + reads)#446
Open
driv3r wants to merge 3 commits into
Open
GTID 2/5: Add coordinate mode (representation + config + reads)#446driv3r wants to merge 3 commits into
driv3r wants to merge 3 commits into
Conversation
Extend BinlogCoordinate with a GTID representation and add the
BinlogCoordinateMode feature flag, without switching binlog streaming.
- BinlogCoordinate gains a GTID form (NewGTIDCoordinate, IsGTID,
ParsedGTIDSet, GTID-aware IsZero/String, JSON). GTID coordinates use
set containment (Contains); Compare panics for GTID since GTID sets
have no total order.
- Config gains BinlogCoordinateMode ("file_position" default, "gtid"
experimental) with validation.
- Add DB helpers: ReadExecutedGTIDSet, ReadCurrentGTIDCoordinate, and
CheckServerGTIDModeEnabled for @@GLOBAL.GTID_EXECUTED / gtid_mode.
- Unit tests for GTID coordinate semantics, JSON round-trip, and mode
validation.
Streaming still runs on file/position; this only adds the GTID
representation, feature flag, and validation groundwork.
Replace the separate Compare (file/position) and Contains (GTID) methods with a single HasReached(target) that answers "has this coordinate reached or passed the target?" and hides the representation-specific mechanics: position comparison for file/position, set containment for GTID. Callers no longer branch on coordinate type to ask the finish-line question.
Add NewGTIDCoordinateFromSet, which clones and caches the parsed mysql.GTIDSet, and make HasReached/ParsedGTIDSet reuse the cache. This removes the per-event serialize+reparse in the stop-condition loop while keeping the value type JSON-stable (the cache is unexported and not serialized). ParsedGTIDSet still returns a mutable clone.
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 2 of 5 — GTID support
Base: #445. Review/merge in stack order.
What this PR does
Extends
BinlogCoordinatewith a GTID representation and adds theBinlogCoordinateModefeature flag, without switching binlog streaming yet.BinlogCoordinategains a GTID form (NewGTIDCoordinate,IsGTID,ParsedGTIDSet, GTID-awareIsZero/String, JSON). GTID coordinates use set containment (Contains);Comparepanics for GTID since GTID sets have no total order.BinlogCoordinateMode(file_positiondefault,gtidexperimental) with validation.ReadExecutedGTIDSet,ReadCurrentGTIDCoordinate,CheckServerGTIDModeEnabled(@@GLOBAL.GTID_EXECUTED/gtid_mode).Streaming still runs on file/position; this only adds the GTID representation, feature flag, and validation groundwork.