mariadb/mysql-test/suite/innodb/r/recovery_shutdown.result
Thirunarayanan Balathandayuthapani 4a1ded61a4 MDEV-34529 Shrink the system tablespace when system tablespace contains MDEV-30671 leaked undo pages
- InnoDB fails to shrink the system tablespace when it contains
the leaked undo log pages caused by MDEV-30671.

- InnoDB does free the unused segment in system tablespace
before shrinking the tablespace. InnoDB fails to free
the unused segment if XA PREPARE transaction exist or
if the previous shutdown was not with innodb_fast_shutdown=0

inode_info: Structure to store the inode page and offsets.

fil_space_t::garbage_collect(): Frees the system tablespace
unused segment

fsp_get_sys_used_segment(): Iterates through all default
file segment and index segment present in system tablespace.

trx_sys_t::is_xa_exist(): Returns true if the XA transaction
exist in the undo logs

fseg_inode_free(): Frees the extents, fragment pages for the
given index node and ignores any error similar to
trx_purge_free_segment()

trx_sys_t::reset_page(): Retain the TRX_SYS_FSEG_HEADER value
in trx_sys page while resetting the page.
2024-10-16 21:34:24 +05:30

69 lines
2.4 KiB
Text

FLUSH TABLES;
call mtr.add_suppression("Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 or XA PREPARE transactions exist");
#
# MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup
# while rolling back recovered incomplete transactions
#
connect con$c,localhost,root,,;
CREATE TABLE t8 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
XA START 'x';
INSERT INTO t8 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t8 SET a=a+100, b=a;
DELETE FROM t8;
XA END 'x';
XA PREPARE 'x';
connect con$c,localhost,root,,;
CREATE TABLE t7 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t7 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t7 SET a=a+100, b=a;
DELETE FROM t7;
connect con$c,localhost,root,,;
CREATE TABLE t6 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t6 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t6 SET a=a+100, b=a;
DELETE FROM t6;
connect con$c,localhost,root,,;
CREATE TABLE t5 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t5 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t5 SET a=a+100, b=a;
DELETE FROM t5;
connect con$c,localhost,root,,;
CREATE TABLE t4 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t4 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t4 SET a=a+100, b=a;
DELETE FROM t4;
connect con$c,localhost,root,,;
CREATE TABLE t3 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t3 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t3 SET a=a+100, b=a;
DELETE FROM t3;
connect con$c,localhost,root,,;
CREATE TABLE t2 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t2 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t2 SET a=a+100, b=a;
DELETE FROM t2;
connect con$c,localhost,root,,;
CREATE TABLE t1 (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 (a) SELECT NULL FROM seq_1_to_100;
UPDATE t1 SET a=a+100, b=a;
DELETE FROM t1;
INSERT INTO t1(a) SELECT NULL FROM seq_1_to_1600;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE MDEV_29559 (a TINYINT UNSIGNED PRIMARY KEY, KEY(a)) ENGINE=InnoDB;
INSERT INTO MDEV_29559 VALUES (0x69);
FLUSH TABLES;
# restart
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
# restart
DROP TABLE MDEV_29559;