feat: MariaDB GTID support#1731
Open
conf wants to merge 1 commit into
Open
Conversation
gh-ost hard-coded the go-mysql binlog syncer to MySQLFlavor and parsed every GTID set as MySQL, so --gtid could not be used against MariaDB. go-mysql already speaks the MariaDB GTID dialect; this wires it up. - Detect server flavor from the version string (IsMariaDB / FlavorFor) and set it on the BinlogSyncerConfig. - Make GTIDBinlogCoordinates hold the flavor-agnostic gomysql.GTIDSet interface; parse via ParseGTIDSet(flavor, ...). - Handle MariadbGTIDEvent alongside GTIDEvent in the streamer, and read the committed GTID set from XIDEvent.GSet without a MySQL-only cast. - Read MariaDB GTID positions from @@global.gtid_binlog_pos, Gtid_IO_Pos and @@global.gtid_slave_pos (MariaDB has no Executed_Gtid_Set column nor gtid_mode / enforce_gtid_consistency). - Skip the gtid_mode / enforce_gtid_consistency validation on MariaDB, where GTIDs are always recorded when binary logging is enabled. localtests: - Detect the server version once and reuse it; run gtid_mode=ON tests on MariaDB (normalize its current_gtid_mode to ON) and trim the GTID diagnostics that don't exist on MariaDB. - Enable gtid_strict_mode on the MariaDB test servers. Because --test-on-replica makes gh-ost write locally on the replica, give the replica its own GTID domain so its writes never collide with the primary's domain-0 stream under strict mode. - Add the gtid-resume case: interrupt a --gtid migration mid-copy via the interactive 'panic' command, then --resume, exercising the GTID checkpoint round-trip (WriteCheckpoint persists the GTID set, ReadLastCheckpoint parses it back via NewGTIDBinlogCoordinates(flavor)). Passes across the MySQL, MariaDB and Percona CI matrix. Verified: full localtests suite passes on MySQL 5.7/8.0/8.4 and on the MariaDB matrix (10.5, 10.6, 10.11, 11.4, 11.8) with gtid_strict_mode on.
a6b31c8 to
167d444
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.
A Pull Request should be associated with an Issue.
Related issue: none yet — happy to open one to discuss direction if preferred.
Description
This PR adds MariaDB GTID support to gh-ost. gh-ost hard-coded the go-mysql binlog syncer to
MySQLFlavorand parsed every GTID set as MySQL, so--gtidcould not be used against MariaDB. go-mysql already speaks the MariaDB GTID dialect; this wires it up.IsMariaDB/FlavorFor) and set it on theBinlogSyncerConfig.GTIDBinlogCoordinateshold the flavor-agnosticgomysql.GTIDSetinterface; parse viaParseGTIDSet(flavor, ...).MariadbGTIDEventalongsideGTIDEventin the streamer, and read the committed GTID set fromXIDEvent.GSetwithout a MySQL-only cast.@@global.gtid_binlog_pos,Gtid_IO_Posand@@global.gtid_slave_pos(MariaDB exposes noExecuted_Gtid_Setcolumn, norgtid_mode/enforce_gtid_consistency).gtid_mode/enforce_gtid_consistencyvalidation on MariaDB, where GTIDs are always recorded when binary logging is enabled.localtests
gtid_mode=ONcases on MariaDB (normalize itscurrent_gtid_modetoON) and trim the GTID diagnostics that don't exist on MariaDB.gtid_strict_modeon the MariaDB test servers. Because--test-on-replicamakes gh-ost write locally on the replica, give the replica its own GTID domain so its writes never collide with the primary's domain-0 stream under strict mode.gtid-resumecase: interrupt a--gtidmigration mid-copy via the interactivepaniccommand, then--resume, exercising the GTID checkpoint round-trip (WriteCheckpointpersists the GTID set,ReadLastCheckpointparses it back viaNewGTIDBinlogCoordinates(flavor, …)).script/cibuildreturns with no formatting errors, build errors or unit test errors.