mariadb/mysql-test/suite/innodb/r/shrink_cached_undo.result
Thirunarayanan Balathandayuthapani 866a8ea673 MDEV-35398 Improve shrinking of system tablespace
Problem:
========
From 10.6.13(86767bcc0f) version,
InnoDB purge thread does free the TRX_UNDO_CACHED undo segment.
Pre-10.6.13 version data directory can contain TRX_UNDO_CACHED
undo segment in system tablespace even though it
has external undo tablespace.

During slow shutdown, InnoDB collects the segment from tables
that exist in system tablespace and cached undo segment in
the system tablespace as used segment exist in system tablespace.
While shrinking the system tablespace, last used extent can be
used by undo cached segment. This extent blocks the shrinking of
system tablespace in a effective way.

Solution:
========
While freeing the unused segment, InnoDB should free the cached
undo segment header page exists in system tablespace and
reset the TRX_RSEG_UNDO_SLOTS to 0xff for the rollback segment
header page exists in system tablespace. This could improve
the shrinking of system tablespace further.
2024-11-19 20:13:24 +05:30

23 lines
911 B
Text

#
# MDEV-35398 Improve shrinking of system tablespace
#
# restart: --debug_dbug=d,skip_cached_undo
SET GLOBAL innodb_file_per_table= 0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t1(f1 INT PRIMARY KEY)ENGINE=InnoDB;
CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR
INSERT INTO t1 SELECT seq FROM seq_1_to_24576;
SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR
INSERT INTO t2 SELECT seq FROM seq_1_to_24576;
# Insert 34 transaction which has undo cached records
DROP TABLE t2, t1;
SET GLOBAL innodb_fast_shutdown=0;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 79691776
# restart
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 12582912