| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/innodb_page_size.inc |
| 3 |
--source include/not_embedded.inc |
| 4 |
|
| 5 |
--echo # |
| 6 |
--echo # MDEV-19229 Allow innodb_undo_tablespaces to be changed |
| 7 |
--echo # after database creation |
| 8 |
--echo # |
| 9 |
call mtr.add_suppression("Found .* prepared XA transactions"); |
| 10 |
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); |
| 11 |
call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); |
| 12 |
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); |
| 13 |
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0"); |
| 14 |
|
| 15 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 16 |
|
| 17 |
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; |
| 18 |
--echo # case 1: XA transaction alone left |
| 19 |
--source include/wait_all_purged.inc |
| 20 |
XA START 'zombie'; |
| 21 |
INSERT INTO t1 VALUES(2); |
| 22 |
XA END 'zombie'; |
| 23 |
XA PREPARE 'zombie'; |
| 24 |
|
| 25 |
--source include/restart_mysqld.inc |
| 26 |
|
| 27 |
--echo # Display 4 undo tablespaces |
| 28 |
select @@global.innodb_undo_tablespaces; |
| 29 |
|
| 30 |
--echo # Should list 4 undo log tablespaces |
| 31 |
list_files $MYSQLD_DATADIR undo*; |
| 32 |
|
| 33 |
XA COMMIT 'zombie'; |
| 34 |
|
| 35 |
--echo # case 2: Successful innodb_undo_tablespace upgrade |
| 36 |
SET GLOBAL innodb_fast_shutdown=0; |
| 37 |
|
| 38 |
let $restart_parameters=--innodb_undo_tablespaces=2; |
| 39 |
--source include/restart_mysqld.inc |
| 40 |
|
| 41 |
--echo # Display 2 undo tablespaces |
| 42 |
SELECT @@global.innodb_undo_tablespaces; |
| 43 |
|
| 44 |
--echo # Should list 2 undo log tablespaces |
| 45 |
list_files $MYSQLD_DATADIR undo*; |
| 46 |
|
| 47 |
DROP TABLE t1; |
| 48 |
--source include/wait_all_purged.inc |
| 49 |
|
| 50 |
--echo # case 3: Reduce the innodb_undo_tablespace to 0 |
| 51 |
let $restart_parameters=--innodb_undo_tablespaces=0; |
| 52 |
--source include/restart_mysqld.inc |
| 53 |
|
| 54 |
--echo # Display 0 undo tablespace |
| 55 |
SELECT @@global.innodb_undo_tablespaces; |
| 56 |
|
| 57 |
--echo # Shouldn't list any undo log tablespaces |
| 58 |
list_files $MYSQLD_DATADIR undo*; |
| 59 |
|
| 60 |
--echo # case 4: Change undo tablespace when force_recovery < 5 |
| 61 |
let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_force_recovery=4; |
| 62 |
--source include/restart_mysqld.inc |
| 63 |
|
| 64 |
--echo # Display 2 undo tablespace |
| 65 |
SELECT @@global.innodb_undo_tablespaces; |
| 66 |
|
| 67 |
--echo # Should list 2 undo log tablespaces |
| 68 |
list_files $MYSQLD_DATADIR undo*; |
| 69 |
|
| 70 |
--echo # case 5: Fail to change undo tablespace when force_recovery > 4 |
| 71 |
let $restart_parameters=--innodb_undo_tablespaces=4 --innodb_force_recovery=5; |
| 72 |
--source include/restart_mysqld.inc |
| 73 |
|
| 74 |
--echo # Display 2 undo tablespace |
| 75 |
SELECT @@global.innodb_undo_tablespaces; |
| 76 |
|
| 77 |
--echo # Should list 2 undo log tablespaces, not 4 |
| 78 |
list_files $MYSQLD_DATADIR undo*; |
| 79 |
|
| 80 |
--echo # |
| 81 |
--echo # MDEV-34200 InnoDB tries to write to read-only |
| 82 |
--echo # system tablespace in buf_dblwr_t::init_or_load_pages() |
| 83 |
--echo # |
| 84 |
|
| 85 |
SET GLOBAL innodb_fast_shutdown=0; |
| 86 |
let $restart_parameters=--innodb_undo_tablespaces=4; |
| 87 |
--source include/restart_mysqld.inc |
| 88 |
--echo # Should list 4 undo log tablespaces |
| 89 |
list_files $MYSQLD_DATADIR undo*; |
| 90 |
|
| 91 |
set global innodb_fast_shutdown=0; |
| 92 |
let $restart_parameters=--innodb_read_only=1; |
| 93 |
--source include/restart_mysqld.inc |
| 94 |
|
| 95 |
set global innodb_fast_shutdown=0; |
| 96 |
let bugdir= $MYSQLTEST_VARDIR/tmp/bugdir; |
| 97 |
mkdir $bugdir; |
| 98 |
let undodir= $MYSQLTEST_VARDIR/tmp/undo_dir; |
| 99 |
mkdir $undodir; |
| 100 |
let $d= --innodb-data-file-path=ibdata1:1M:autoextend; |
| 101 |
let $d=$d --innodb_undo_directory=$undodir; |
| 102 |
let $restart_parameters= $d --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir --innodb_undo_tablespaces=3; |
| 103 |
--source include/restart_mysqld.inc |
| 104 |
--echo # Should list 3 undo log tablespaces |
| 105 |
list_files $undodir undo*; |
| 106 |
|
| 107 |
let bugdir_1= $MYSQLTEST_VARDIR/tmp/bugdir_1; |
| 108 |
mkdir $bugdir_1; |
| 109 |
|
| 110 |
set global innodb_fast_shutdown=0; |
| 111 |
let $restart_parameters= $d --innodb-data-home-dir=$bugdir_1 --innodb-log-group-home-dir=$bugdir_1 --innodb_undo_tablespaces=0; |
| 112 |
--source include/restart_mysqld.inc |
| 113 |
--echo # Shouldn't list 0 undo log tablespaces |
| 114 |
list_files $undodir undo*; |
| 115 |
|
| 116 |
set global innodb_fast_shutdown=0; |
| 117 |
let $restart_parameters=; |
| 118 |
--source include/restart_mysqld.inc |
| 119 |
rmdir $bugdir; |
| 120 |
rmdir $bugdir_1; |
| 121 |
rmdir $undodir; |