[MDEV-32452] InnoDB system tablespace is not shrunk on slow shutdown Created: 2023-10-12  Updated: 2023-11-28  Resolved: 2023-11-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 11.2, 11.3
Fix Version/s: 11.2.3

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 1
Labels: shutdown

Issue Links:
Blocks
is blocked by MDEV-14795 InnoDB system tablespace cannot be sh... Closed

 Description   

jeanfrancois.gagne suggested that it would be easier for users if they did not have to modify any start-up parameters (adding an :autoshrink attribute to innodb_data_file_path) but could simply have InnoDB shrink the system tablespace during a slow shutdown (after SET GLOBAL innodb_fast_shutdown=0).

The reason why the :autoshrink attribute was introduced in MDEV-14795 to make the cleanup opt-in was twofold: to reduce the InnoDB startup time and to avoid any trouble in case the system tablespace is corrupted in any way. The way the feature is implemented should avoid trouble, by first checking that everything is consistent and then making the modifications.

Attempting to shrink the system tablespace on a slow shutdown will retain the opt-in aspect: the default value is innodb_fast_shutdown=1. The time needed for shrinking the system tablespace should be negligible (some seconds) compared to the time needed for a complete purge of committed transaction history (which could even be hours, depending on the state of the database).

Dedicated undo tablespaces will be truncated based on the value of the settable global variable innodb_undo_log_truncate. That logic would not be touched here.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2023-11-04 ]

Patch is in bb-11.2-MDEV-32452

Comment by Marko Mäkelä [ 2023-11-07 ]

The patch looks OK, except I would add the call at the very end of innodb_preshutdown and skip it for mariadb-backup. Can you please fix that? Currently some ./mtr --suite=mariabackup tests are failing on all builders.

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