summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/t/undo_upgrade.test
blob: f27eae334d877318dfaf34a0c21890036e64dc8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--source include/have_innodb.inc
--source include/innodb_page_size.inc
--source include/not_embedded.inc

--echo #
--echo #  MDEV-19229 Allow innodb_undo_tablespaces to be changed
--echo #	after database creation
--echo #
call mtr.add_suppression("Found .* prepared XA transactions");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0");

let $MYSQLD_DATADIR= `select @@datadir`;

CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
--echo # case 1: XA transaction alone left
--source include/wait_all_purged.inc
XA START 'zombie';
INSERT INTO t1 VALUES(2);
XA END 'zombie';
XA PREPARE 'zombie';

--source include/restart_mysqld.inc

--echo # Display 4 undo tablespaces
select @@global.innodb_undo_tablespaces;

--echo # Should list 4 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;

XA COMMIT 'zombie';

--echo # case 2: Successful innodb_undo_tablespace upgrade
SET GLOBAL innodb_fast_shutdown=0;

let $restart_parameters=--innodb_undo_tablespaces=2;
--source include/restart_mysqld.inc

--echo # Display 2 undo tablespaces
SELECT @@global.innodb_undo_tablespaces;

--echo # Should list 2 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;

DROP TABLE t1;
--source include/wait_all_purged.inc

--echo # case 3: Reduce the innodb_undo_tablespace to 0
let $restart_parameters=--innodb_undo_tablespaces=0;
--source include/restart_mysqld.inc

--echo # Display 0 undo tablespace
SELECT @@global.innodb_undo_tablespaces;

--echo # Shouldn't list any undo log tablespaces
list_files $MYSQLD_DATADIR undo*;

--echo # case 4: Change undo tablespace when force_recovery < 5
let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_force_recovery=4;
--source include/restart_mysqld.inc

--echo # Display 2 undo tablespace
SELECT @@global.innodb_undo_tablespaces;

--echo # Should list 2 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;

--echo # case 5: Fail to change undo tablespace when force_recovery > 4
let $restart_parameters=--innodb_undo_tablespaces=4 --innodb_force_recovery=5;
--source include/restart_mysqld.inc

--echo # Display 2 undo tablespace
SELECT @@global.innodb_undo_tablespaces;

--echo # Should list 2 undo log tablespaces, not 4
list_files $MYSQLD_DATADIR undo*;

--echo #
--echo # MDEV-34200 InnoDB tries to write to read-only
--echo #    system tablespace in buf_dblwr_t::init_or_load_pages()
--echo #

SET GLOBAL innodb_fast_shutdown=0;
let $restart_parameters=--innodb_undo_tablespaces=4;
--source include/restart_mysqld.inc
--echo # Should list 4 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;

set global innodb_fast_shutdown=0;
let $restart_parameters=--innodb_read_only=1;
--source include/restart_mysqld.inc

set global innodb_fast_shutdown=0;
let bugdir= $MYSQLTEST_VARDIR/tmp/bugdir;
mkdir $bugdir;
let undodir= $MYSQLTEST_VARDIR/tmp/undo_dir;
mkdir $undodir;
let $d= --innodb-data-file-path=ibdata1:1M:autoextend;
let $d=$d --innodb_undo_directory=$undodir;
let $restart_parameters= $d --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir --innodb_undo_tablespaces=3;
--source include/restart_mysqld.inc
--echo # Should list 3 undo log tablespaces
list_files $undodir undo*;

let bugdir_1= $MYSQLTEST_VARDIR/tmp/bugdir_1;
mkdir $bugdir_1;

set global innodb_fast_shutdown=0;
let $restart_parameters= $d --innodb-data-home-dir=$bugdir_1 --innodb-log-group-home-dir=$bugdir_1 --innodb_undo_tablespaces=0;
--source include/restart_mysqld.inc
--echo # Shouldn't list 0 undo log tablespaces
list_files $undodir undo*;

set global innodb_fast_shutdown=0;
let $restart_parameters=;
--source include/restart_mysqld.inc
rmdir $bugdir;
rmdir $bugdir_1;
rmdir $undodir;