Overview
An online learning platform served course content and student progress from a MariaDB primary with several replicas behind MaxScale. Teachers had reported progress screens that showed old data after a bulk import, and nobody was sure the automated failover had ever been exercised end to end.
Challenge
Several problems sat together. The readwritesplit router had no replication lag limit, so a lagging replica kept receiving reads. Some large tables had no primary key, which turns every row event into a full scan on a replica under row-based replication. And the promotion script had been adapted from a MySQL runbook that assumes UUID-based GTIDs, which MariaDB does not use.
Environment
One MariaDB 10.11 primary and four replicas on managed virtual machines in a single cloud, with MaxScale 23 in front and Prometheus for monitoring.
Approach
AceMQ inspected runtime configuration and replication state directly, then ran a controlled failover in a staging copy to see what the script did. Findings were ranked by how likely each was to cause stale data or a failed promotion.
Solution
- Compared gtid_slave_pos, gtid_binlog_pos and gtid_current_pos across servers and checked gtid_strict_mode and domain IDs
- Identified tables with no primary key and quantified the replica apply cost of each under row-based replication
- Set a maximum replication lag in MaxScale readwritesplit and reviewed the MariaDB Monitor failover settings
- Ran a staged failover, which showed the promotion script choosing the wrong position, and rewrote it for MariaDB GTIDs
- Checked parallel replication settings against the batch window and transaction sizes
- Delivered a ranked findings report with a fix order and the checks to repeat after each change
Outcome
The customer got a clear list of what would have gone wrong in a real failover, and fixed the promotion script and the lag limit within two weeks. Stale progress screens stopped appearing after bulk imports, and the staged failover now runs as a quarterly check.