| 1 |
# |
| 2 |
# MDEV-19229 Allow innodb_undo_tablespaces to be changed |
| 3 |
# after database creation |
| 4 |
# |
| 5 |
call mtr.add_suppression("Found .* prepared XA transactions"); |
| 6 |
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); |
| 7 |
call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); |
| 8 |
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); |
| 9 |
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0"); |
| 10 |
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; |
| 11 |
# case 1: XA transaction alone left |
| 12 |
InnoDB 0 transactions not purged |
| 13 |
XA START 'zombie'; |
| 14 |
INSERT INTO t1 VALUES(2); |
| 15 |
XA END 'zombie'; |
| 16 |
XA PREPARE 'zombie'; |
| 17 |
# restart |
| 18 |
# Display 4 undo tablespaces |
| 19 |
select @@global.innodb_undo_tablespaces; |
| 20 |
@@global.innodb_undo_tablespaces |
| 21 |
4 |
| 22 |
# Should list 4 undo log tablespaces |
| 23 |
undo001 |
| 24 |
undo002 |
| 25 |
undo003 |
| 26 |
undo004 |
| 27 |
XA COMMIT 'zombie'; |
| 28 |
# case 2: Successful innodb_undo_tablespace upgrade |
| 29 |
SET GLOBAL innodb_fast_shutdown=0; |
| 30 |
# restart: --innodb_undo_tablespaces=2 |
| 31 |
# Display 2 undo tablespaces |
| 32 |
SELECT @@global.innodb_undo_tablespaces; |
| 33 |
@@global.innodb_undo_tablespaces |
| 34 |
2 |
| 35 |
# Should list 2 undo log tablespaces |
| 36 |
undo001 |
| 37 |
undo002 |
| 38 |
DROP TABLE t1; |
| 39 |
InnoDB 0 transactions not purged |
| 40 |
# case 3: Reduce the innodb_undo_tablespace to 0 |
| 41 |
# restart: --innodb_undo_tablespaces=0 |
| 42 |
# Display 0 undo tablespace |
| 43 |
SELECT @@global.innodb_undo_tablespaces; |
| 44 |
@@global.innodb_undo_tablespaces |
| 45 |
0 |
| 46 |
# Shouldn't list any undo log tablespaces |
| 47 |
# case 4: Change undo tablespace when force_recovery < 5 |
| 48 |
# restart: --innodb_undo_tablespaces=2 --innodb_force_recovery=4 |
| 49 |
# Display 2 undo tablespace |
| 50 |
SELECT @@global.innodb_undo_tablespaces; |
| 51 |
@@global.innodb_undo_tablespaces |
| 52 |
2 |
| 53 |
# Should list 2 undo log tablespaces |
| 54 |
undo001 |
| 55 |
undo002 |
| 56 |
# case 5: Fail to change undo tablespace when force_recovery > 4 |
| 57 |
# restart: --innodb_undo_tablespaces=4 --innodb_force_recovery=5 |
| 58 |
# Display 2 undo tablespace |
| 59 |
SELECT @@global.innodb_undo_tablespaces; |
| 60 |
@@global.innodb_undo_tablespaces |
| 61 |
2 |
| 62 |
# Should list 2 undo log tablespaces, not 4 |
| 63 |
undo001 |
| 64 |
undo002 |
| 65 |
# |
| 66 |
# MDEV-34200 InnoDB tries to write to read-only |
| 67 |
# system tablespace in buf_dblwr_t::init_or_load_pages() |
| 68 |
# |
| 69 |
SET GLOBAL innodb_fast_shutdown=0; |
| 70 |
# restart: --innodb_undo_tablespaces=4 |
| 71 |
# Should list 4 undo log tablespaces |
| 72 |
undo001 |
| 73 |
undo002 |
| 74 |
undo003 |
| 75 |
undo004 |
| 76 |
set global innodb_fast_shutdown=0; |
| 77 |
# restart: --innodb_read_only=1 |
| 78 |
set global innodb_fast_shutdown=0; |
| 79 |
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb_undo_tablespaces=3 |
| 80 |
# Should list 3 undo log tablespaces |
| 81 |
undo001 |
| 82 |
undo002 |
| 83 |
undo003 |
| 84 |
set global innodb_fast_shutdown=0; |
| 85 |
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb_undo_tablespaces=0 |
| 86 |
# Shouldn't list 0 undo log tablespaces |
| 87 |
set global innodb_fast_shutdown=0; |
| 88 |
# restart |