Skip to content

Commit 9e188c8

Browse files
committed
fix(replication): treat MariaDB 11+ like 10.x in GreaterOrEqualVersion
Closes #82. `common.GreaterOrEqualVersion(version, comparedTo)` carries a long-standing guard for MariaDB 10: if major == 10 { return false, nil } The intent was to keep flavor-blind version comparisons from misclassifying MariaDB as "newer than MySQL X.Y" when the two version number lines have diverged. The guard worked while MariaDB stayed in the 10.x line, but when MariaDB went to 11.x, the function started returning true for MariaDB 11.4.9 against the MySQL-derived `MinimumChangeReplicationSourceVersion` ({8,0,23}) — so `sandbox/replication.go::replicationCommands` emitted `CHANGE REPLICATION SOURCE TO` for MariaDB 11.4, which MariaDB doesn't recognize: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; ... near 'REPLICATION SOURCE TO source_host="127.0.0.1" ... `initialize_slaves` then aborted before issuing CHANGE MASTER, slaves never connected to the primary, and the only users on the slaves were the bootstrap root account — manifesting at the user level as the reported `Access denied for user 'msandbox'@'localhost'`. Extending the guard to `major >= 10` covers MariaDB 11.x (and any future MariaDB major bumps) until a proper flavor-aware migration of these call-sites to `common.HasCapability(flavor, feature, version)` is done. MySQL itself has not shipped a 10.x or 11.x line (current MySQL is 9.x), so this remains safe in practice. Verified end-to-end on Ubuntu/x86_64 with the 11.4.9 systemd tarball from archive.mariadb.org: before fix: deploy replication 11.4.9 → initialize_slaves fails silently slave 'use' → Access denied for user 'msandbox'@'localhost' after fix: deploy replication 11.4.9 → CHANGE MASTER TO / START REPLICA succeed slave 'use' → 1 (auth works) check_slaves → both slaves at master log position, IO+SQL running This also touches every other replication path that consulted `GreaterOrEqualVersion` (multi-source, group, pxc, innodb-cluster, replication) — all of which were previously skipped for MariaDB 10 and are now correctly skipped for MariaDB 11+ as well.
1 parent ef4ee6c commit 9e188c8

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

common/checks.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,15 @@ func GreaterOrEqualVersion(version string, comparedTo []int) (bool, error) {
669669
minor := verList[1]
670670
rev := verList[2]
671671

672-
// TODO: MariaDB 10.4 has changed behavior with regards to the above assumptions - Needs some more work
673-
if major == 10 {
672+
// MariaDB 10.x and 11.x retain the historical replication syntax
673+
// (CHANGE MASTER TO, show slave status, master_pos_wait, etc.) and do
674+
// not adopt the MySQL 8.0.23+ SOURCE-named replacements. MySQL itself
675+
// has not shipped a 10.x or 11.x major line, so treating any version
676+
// with major >= 10 as MariaDB is safe in practice. Without this guard,
677+
// MariaDB 11+ was being treated as "newer than MySQL 8.0.23" and the
678+
// generated init_slaves script emitted CHANGE REPLICATION SOURCE TO,
679+
// which MariaDB rejects with a syntax error (issue #82).
680+
if major >= 10 {
674681
return false, nil
675682
}
676683
versionText := fmt.Sprintf("%02d%02d%02d", major, minor, rev)

0 commit comments

Comments
 (0)