Scale-out storage: read replicas on MySQL, tested (ST-10, ST-15, tests 17 to 19)

Two source-and-replica pairs run in containers: one replicating with
GTIDs, one by binary log position. mysql_replica_tests covers test 17
(tests 9, 10 and 12 with GTIDs) and mysql_replica_position_tests covers
test 18 (lag from Seconds_Behind_Source, and a replica whose account
lacks REPLICATION CLIENT getting no reads) and test 19 (a parallel
replica without replica_preserve_commit_order left out at startup).

The lag reader now takes Seconds_Behind_Source whatever numeric type the
server returns, accepts the older column name, and says in the log why it
gave up measuring.
This commit is contained in:
2026-09-19 14:53:31 -07:00
parent 216bb5b711
commit e913a22b66
5 changed files with 475 additions and 6 deletions
+37
View File
@@ -91,6 +91,43 @@ pub async fn build_data_store(typ: &str, path: &str) -> DataStore {
..Default::default()
});
}
// inbuxa: a MySQL source with a replica, with and without GTIDs
if let Some(gtid) = match typ {
"MySqlReplicated" => Some(true),
"MySqlReplicatedPosition" => Some(false),
_ => None,
} {
crate::utils::containers::ensure_mysql_replicated(gtid).await;
let (primary, replica) = if gtid {
crate::utils::containers::MYSQL_GTID_PORTS
} else {
crate::utils::containers::MYSQL_POS_PORTS
};
let secret = || {
SecretKeyOptional::Value(SecretKeyValue {
secret: "password".into(),
})
};
return DataStore::MySql(MySqlStore {
host: "localhost".into(),
port: primary as u64,
auth_username: "root".to_string().into(),
auth_secret: secret(),
database: "stalwart".into(),
use_tls: false,
allow_invalid_certs: true,
read_replicas: registry::types::list::List::from_iter([
registry::schema::structs::MySqlSettings {
host: "localhost".into(),
port: replica as u64,
database: "stalwart".into(),
auth_username: "root".to_string().into(),
auth_secret: secret(),
},
]),
..Default::default()
});
}
if typ == "MariaDb" {
crate::utils::containers::ensure_mariadb().await;
return DataStore::MySql(MySqlStore {