In July my search engine's MySQL server, running in Docker on the pipeline server, was replaced with Percona Server. The reason was a plan to move the biggest table, the link graph, to the RocksDB storage engine later, and Percona Server ships it as MyRocks; the image includes the ha_rocksdb.so plugin. The swap itself was meant to change nothing: Percona Server is a drop-in replacement that uses the same InnoDB data format, so the existing data directory could be reused as it was.
It nearly changed a lot, silently, because the two images read their configuration from different directories.
Where each image looks for config
The project's MySQL tuning lived in its own my.cnf, mounted into the container. With the Oracle mysql image, that mount went to /etc/mysql/conf.d/. The image's main /etc/my.cnf includes that directory:
mysql:8.0:!includedir /etc/mysql/conf.d/percona/percona-server:8.0:!includedir /etc/my.cnf.d
In the Percona image, /etc/mysql/conf.d doesn't exist at all, and nothing in its configuration refers to it. A file mounted there is never read. The server starts, runs, answers queries and reports no error. It just runs with its own defaults.
This was caught during a local trial of the swap, where the development tuning file turned out not to be read at all. The production compose file then replaced the volume list for the Percona service instead of appending to it, mounting the same file at /etc/my.cnf.d/zz-app.cnf.
What would have reverted
Some settings were safe either way, because they were passed as command-line options in the compose file: the buffer pool size, the I/O capacity settings, flush neighbours and the time zone. Everything that only existed in my.cnf would have quietly gone back to Percona's defaults:
- skipping the binary log
innodb_flush_log_at_trx_commitinnodb_log_file_sizeinnodb_adaptive_hash_indexinnodb_doublewrite
The comment in the compose file is clear that these weren't cosmetic. Two of them were fixes for earlier incidents on the same server: latch contention in the adaptive hash index, and checkpoint stalls from an undersized redo log. The doublewrite setting matters in the other direction: it was deliberately off, which is also why the same compose file gives MySQL a long grace period to shut down cleanly. A silent revert would have undone two incident fixes and changed the server's durability behavior, without a single error message.
Doing the swap safely
Besides the config path, the swap had the usual safety net: a full mysqldump right before deploying, as a rollback safety net. The data directory compatibility had been checked in the same local trial before it was trusted in production. And the change was deliberately only the server swap: the storage-engine migration it prepared for lived on a separate branch, not merged, so the swap could be judged on its own.
The lesson: check what the server is running with
The general version of this applies to any containerised service: a config file you mount is only a file. Whether the service reads it depends on the image, and images built from different packaging, even of the same software, put their config in different places. So check the effective settings after a change, not the file you mounted. For MySQL and its forks, that's a query:
SELECT @@innodb_doublewrite, @@innodb_flush_log_at_trx_commit, @@innodb_log_file_size;
If the answers are the defaults, the file isn't being read. It's the same lesson as an sshd setting that the server never applied: the configuration that matters is the one the process is running with, and the only way to know it is to ask the process.
Leave a comment
Comments are reviewed before they appear.