How to verify a clean MariaDB shutdown in logs before a major version upgrade?

Hi! Congrats on the MariaDB 11.8 release! So far in Debian and Ubuntu no regressions have been reported and looks everything is working well. The most frequent thing I see people complain about is not new to 11.8, but I think introduced in 10.4 with InnoDB refusing to start if crash recovery is needed for a database of an earlier major version. This is explained in e.g. https://web.archive.org/web/20240912062010/https://mariadb.com/kb/en/innodb-... To help DBAs ensure they have a clean shutdown before doing a major version upgrade, I was wondering what are the best ways to confirm a clean shutdown by checking the MariaDB logs or files in /var/log/mysql? Specifically, what log entries or patterns in the MariaDB logs indicate a clean shutdown? Additionally, are there particular files or indicators in /var/log/mysql that reliably show the clean shutdown status? For example, if all buffers were flushed, should I expect that some files have size zero?

Hi Otto, If you have the complete server error log, then one could check the following ... 1. Then looking for following pattern would ensure that server was shutdown by a command and is not killed abnormally. /2025-06-20 21:11:51 0 [Note] mariadbd (initiated by: debanerj[debanerj] @ localhost []): Normal shutdown 2025-06-20 21:11:51 0 [Note] InnoDB: Starting shutdown... 2025-06-20 21:11:52 0 [Note] InnoDB: Shutdown completed; log sequence number 390485542; transaction id 1078/ 2. When innodb_fast_shutdown=2 is set, a recovery would be needed even after shutdown is triggered. Then the log should contain a line warning about that. /2025-06-20 21:14:51 0 [Note] mariadbd (initiated by: debanerj[debanerj] @ localhost []): Normal shutdown 2025-06-20 21:14:51 0 [Note] InnoDB: Starting shutdown... *2025-06-20 21:14:51 0 [Note] InnoDB: Executing innodb_fast_shutdown=2. Next startup will execute crash recovery!* 2025-06-20 21:14:51 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2025-06-20 21:14:51 0 [Note] InnoDB: Shutdown completed; log sequence number 0; transaction id 1078 2025-06-20 21:14:51 0 [Note] mariadbd: Shutdown complete/ There is inherent risk here that we may not be looking at the latest server log. Unfortunately, AFAIK, there is no easy way to find out whether recovery is needed by looking at files in data directory. It would need parsing the redo logs. The safest way for a DBA is to start the server once and shutdown again with innodb_fast_shutdown=0 (slow shutdown) before going for an upgrade. 1. Start server and check the error log for the recovery message. /2025-06-20 21:24:14 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=390485526/ 2. Connect to the server MariaDB [(none)]> set global innodb_fast_shutdown=0; MariaDB [(none)]> shutdown; 3. If step [1] shows the recovery message then repeat the steps from [1] once more to confirm that no recovery message appears. * In above steps, innodb_fast_shutdown=1 (default) would also work and could be a bit faster but I recommend the slow shutdown which also takes care of purging any left over undo records. Regards, Deb
participants (2)
-
Debarun Banerjee
-
Otto Kekäläinen