Skip to content

GTID 1/5: Introduce BinlogCoordinate abstraction (file/position backed)#445

Open
driv3r wants to merge 1 commit into
mainfrom
gtid-stage1-binlog-coordinate
Open

GTID 1/5: Introduce BinlogCoordinate abstraction (file/position backed)#445
driv3r wants to merge 1 commit into
mainfrom
gtid-stage1-binlog-coordinate

Conversation

@driv3r

@driv3r driv3r commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Stacked PR 1 of 5 — GTID support

This is the first PR in a stack that adds opt-in GTID binlog-coordinate support to Ghostferry, keeping file/position as the default and fully backward compatible.

Stack

  1. This PR — BinlogCoordinate abstraction (file/position backed) → base main
  2. GTID coordinate mode (representation + config + reads) → base this branch
  3. GTID binlog streaming start/stop → base no. 2)
  4. Persist GTID coordinates in state + enable resume → base no. 3)
  5. GTID-aware replica catchup → base no. 4)

What this PR does

Introduces a representation-agnostic BinlogCoordinate type as the seam for a future GTID mode, without changing current behavior.

  • BinlogCoordinate wraps mysql.Position today (type file_position), with gtid reserved. Provides IsZero/Compare/String and self-describing JSON that also decodes bare {Name,Pos} payloads for backward compatibility.
  • StateTracker/SerializableState gain coordinate accessors that delegate to the existing file/position storage; legacy mysql.Position API and serialized fields are unchanged.
  • DMLEvent gains BinlogCoordinate()/ResumableBinlogCoordinate(); BinlogStreamer gains GetLastStreamedBinlogCoordinate().
  • Unit tests for coordinate basics, comparison, and JSON round-trip (including legacy decode paths).

No behavior change: everything still runs on file/position. This is the foundation for adding GTID support behind a feature flag.

Add a representation-agnostic BinlogCoordinate type as the seam for a
future GTID binlog-coordinate mode, without changing current behavior.

- BinlogCoordinate wraps mysql.Position today (type "file_position"),
  with "gtid" reserved. Provides IsZero/Compare/String and
  self-describing JSON that also decodes bare {Name,Pos} payloads for
  backward compatibility.
- StateTracker/SerializableState gain coordinate accessors and mutators
  that delegate to the existing file/position storage; legacy
  mysql.Position API and serialized fields are unchanged.
- DMLEvent gains BinlogCoordinate()/ResumableBinlogCoordinate() and
  BinlogStreamer gains GetLastStreamedBinlogCoordinate().
- Add unit tests for coordinate basics, comparison, and JSON round-trip
  (including legacy decode paths).

No behavior change: everything still runs on file/position. This is the
foundation for adding GTID support behind a feature flag.
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