From 61850162caf1e341abc6f17763fb630d9f28857f Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Sat, 12 Sep 2026 10:03:00 +0000 Subject: [PATCH] [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 Claude-Session: https://claude.ai/code/session_01EsVtbd7MxMVsS9vP1H6KPS --- management/server/testutil/store.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index 07699e2c3..aac60f7e8 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -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),