[MDEV-33062] innodb_undo_log_truncate=ON prevents fast shutdown Created: 2023-12-19  Updated: 2023-12-20  Resolved: 2023-12-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3, 11.3.2

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance, shutdown

Issue Links:
Relates
relates to MDEV-33009 Server hangs for a long time with inn... Closed

 Description   

When the function trx_purge_truncate_history() is shrinking undo tablespaces due to innodb_undo_log_truncate=ON, it will keep doing so even after a fast shutdown has been initiated. It should only do that on a shutdown with innodb_fast_shutdown=0.

This was noticed by axel while testing the fix of MDEV-33009.



 Comments   
Comment by Axel Schwenke [ 2023-12-19 ]

The fix works for me. Before this patch a large UNDO truncate operation needed more than 20 min and delayed the shutdown for the same time. With the patch the truncate was aborted after ~30 seconds and the fast shutdown completed.

Before:

2023-12-18 13:17:28 0 [Note] /home/galera/mariadb-install/mariadb-10.6-MDEV-33009-9682add5cdf/libexec/mariadbd (initiated by: root[root]
 @ localhost []): Normal shutdown                                                                                                       
2023-12-18 13:17:28 0 [Note] InnoDB: FTS optimize thread exiting.                                                                       
2023-12-18 13:41:49 0 [Note] InnoDB: Truncated .//undo001                                                                               
2023-12-18 13:41:49 0 [Note] InnoDB: Truncating .//undo002                                                                              
2023-12-18 13:41:49 0 [Note] InnoDB: Truncated .//undo002                                                                               
2023-12-18 13:41:49 0 [Note] InnoDB: Truncating .//undo003                                                                              
2023-12-18 13:41:49 0 [Note] InnoDB: Truncated .//undo003                                                                               
2023-12-18 13:41:49 0 [Note] InnoDB: Starting shutdown...                                                                               
2023-12-18 13:41:49 0 [Note] InnoDB: Executing innodb_fast_shutdown=2. Next startup will execute crash recovery!                        
2023-12-18 13:41:50 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"                                                 
2023-12-18 13:41:50 0 [Note] InnoDB: Shutdown completed; log sequence number 0; transaction id 24280429

After:

2023-12-19 10:54:05 0 [Note] /home/galera/mariadb-install/mariadb-10.6-MDEV-33062-3ef0e678b1c/libexec/mariadbd (initiated by: root[root]
 @ localhost []): Normal shutdown                                                                                                       
2023-12-19 10:54:05 0 [Note] InnoDB: FTS optimize thread exiting.                                                                       
2023-12-19 10:54:05 0 [Note] InnoDB: Starting shutdown...                                                                               
2023-12-19 10:54:39 0 [Note] InnoDB: Executing innodb_fast_shutdown=2. Next startup will execute crash recovery!                        
2023-12-19 10:54:40 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"                                                 
2023-12-19 10:54:40 0 [Note] InnoDB: Shutdown completed; log sequence number 0; transaction id 24248985

Generated at Thu Feb 08 10:36:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.