Skip to content

GTID 2/5: Add coordinate mode (representation + config + reads)#446

Open
driv3r wants to merge 3 commits into
gtid-stage1-binlog-coordinatefrom
gtid-stage2-coordinate-mode
Open

GTID 2/5: Add coordinate mode (representation + config + reads)#446
driv3r wants to merge 3 commits into
gtid-stage1-binlog-coordinatefrom
gtid-stage2-coordinate-mode

Conversation

@driv3r

@driv3r driv3r commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Stacked PR 2 of 5 — GTID support

Base: #445. Review/merge in stack order.

What this PR does

Extends BinlogCoordinate with a GTID representation and adds the BinlogCoordinateMode feature flag, without switching binlog streaming yet.

  • 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.
  • DB helpers: ReadExecutedGTIDSet, ReadCurrentGTIDCoordinate, CheckServerGTIDModeEnabled (@@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.

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.
@driv3r
driv3r requested review from a team, milanatshopify and pawandubey July 22, 2026 13:34
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.
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

Successfully merging this pull request may close these issues.

1 participant