feat: stream MariaDB GTIDs

Merged
RE
2mo ago
+1342-34

Summary

  • Add MariaDB domain-server-seq GTID parsing and watermark serialization.
  • Auto-detect the reader snapshot GTID format and use @@gtid_binlog_pos when the executed-set column is absent.
  • Stream MariaDB GTID_EVENT as the existing ST=/I1=/I2= wire protocol with the domain as the id.
  • Add a live MariaDB 10.11 integration service and TAP coverage.

Test plan

  • make -C test/tap
  • ./test/tap/tests/test_mariadb_gtid-t 42/42
  • ./test/tap/tests/test_mariadb_gtid_stream-t 3/3 against MariaDB 10.11.18

Summary by cubic

Adds MariaDB GTID support to the binlog reader so it can snapshot and stream domain-server-sequence GTIDs on the existing ST=/I1=/I2= wire protocol.

  • Auto-detects MySQL vs MariaDB GTID strings; a present non-empty executed-set column is parsed with the auto-detecting parser and malformed text fails startup, while a missing or empty column falls back to @@gtid_binlog_pos (an empty value is a valid empty position before the server's first GTID).
  • Streams MariaDB GTID_EVENT with the domain as the wire id and sequence as the transaction id; @mariadb_slave_capability is now sent only to MariaDB servers.
  • to_string() keeps the wire format for domain keys (0:1-270); new to_display_string() emits the native 0-1-270 form.
  • Rejects domain/server ids wider than UINT32_MAX instead of truncating them, and skips re-delivered GTIDs already covered by the snapshot position.
  • Adds a MariaDB 10.11 docker-compose service and live TAP coverage (test_mariadb_gtid_stream-t) that pins the reader output against a shared wire-contract fixture duplicated in the ProxySQL repository.

Summary by CodeRabbit

  • New Features
    • Added support for reading MariaDB GTID positions from snapshots and live binlog streams, including positions across multiple domains. Existing replication message formats remain unchanged.
    • MariaDB GTID positions can be displayed with domain, server ID, and sequence information. MySQL GTID handling remains supported.
  • Bug Fixes
    • Improved snapshot handling when MariaDB does not provide a MySQL-style executed GTID set. Empty positions are accepted, while malformed or out-of-range GTID data is rejected.
    • Duplicate GTIDs no longer generate redundant position updates.