[management] Turn off durability work in the MySQL test container

Cloning the schema from a template cut the per-test store cost on
Postgres from about 0.9s to 0.3s but barely moved MySQL, which stayed at
1.5s to 1.9s per store. The time is the DDL itself: with the server
defaults each CREATE TABLE creates and fsyncs a tablespace file and
fsyncs the redo log and the binary log, and the suite issues about 40 of
them per test.

Start mysqld in the test container without per-table tablespaces,
without the binary log, without the doublewrite buffer and without a
redo fsync per commit. The image is the official MySQL entrypoint, so
the flags are passed as the container command.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EsVtbd7MxMVsS9vP1H6KPS
This commit is contained in:
Maycon Santos
2026-09-12 10:03:00 +00:00
co-authored by Claude Fable 5.1
parent 33de7593e2
commit 61850162ca
+11
View File
@@ -37,6 +37,17 @@ func CreateMysqlTestContainer() (func(), string, error) {
mysql.WithDatabase("testing"),
mysql.WithUsername("root"),
mysql.WithPassword("testing"),
// Every test creates and drops a database with about 40 tables, so with
// the server defaults the run is dominated by durability work: each
// CREATE TABLE creates and fsyncs its own tablespace file and fsyncs the
// redo and binary logs. None of it protects anything in a container that
// is discarded after the run.
testcontainers.WithCmd("mysqld",
"--innodb-file-per-table=OFF",
"--innodb-flush-log-at-trx-commit=0",
"--innodb-doublewrite=OFF",
"--skip-log-bin",
),
testcontainers.WithWaitStrategy(
wait.ForLog("/usr/sbin/mysqld: ready for connections").
WithOccurrence(1).WithStartupTimeout(15*time.Second).WithPollInterval(100*time.Millisecond),