Debian Codegraph @

mysql-test/suite/innodb/t/create_table_sys_tablespace_extend.test

raw
1 # Bug#36511673 MLOG_FILE_EXTEND log record is not redo logged for System
2 # tablespace
3 # Users can create the tables in the system tablespace. System tablespace
4 # may expand as the table(s) grow. This test verifies that System
5 # tablespace expansion is redo logged and, crash recovery works.
6 #
7 --source include/linux.inc
8 --source include/have_debug.inc
9 --source include/have_innodb_16k.inc
10
11 let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/test_data_dir;
12 let $MYSQLD_ERROR_LOG = $MYSQL_TMP_DIR/mysqld_test.err;
13
14 # It is pre-requisite of this test to have system tablespace of default size.
15 # It is possible only if test explicitly creates the new datadir for the
16 # stability (e.g. test runing with --repeat option) reasons.
17 --echo # Initialize new data directory...
18 let $MYSQLD_EXTRA_ARGS = --innodb_page_size=16384;
19 --source include/initialize_datadir.inc
20 let restart_parameters = restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_ERROR_LOG;
21
22 --echo # Restart on the new data directory...
23 --replace_result $MYSQLD_ERROR_LOG my_restart.err $MYSQLD_DATADIR tmp/test_data_dir
24 --source include/restart_mysqld.inc
25
26 SELECT @@GLOBAL.innodb_redo_log_capacity;
27 SELECT @@GLOBAL.innodb_data_file_path;
28
29 --echo # Disable page cleaner to have redo logs for recovery later on
30 --source suite/innodb/include/log_disable_page_cleaners.inc
31
32 SET @@GLOBAL.DEBUG='+d,ib_redo_log_system_tablespace_expansion';
33 # Force to have only two records per page
34 SET GLOBAL innodb_limit_optimistic_insert_debug=2;
35
36 CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50),
37 PRIMARY KEY (`id`)) TABLESPACE=innodb_system;
38 INSERT INTO t1 VALUES(0, REPEAT('a', 50));
39
40 let $max_counter=8;
41 let $counter = 1;
42 --echo #
43 --echo # Insert 2^$max_counter records
44 --echo #
45 --disable_query_log
46 while($counter <= $max_counter){
47 INSERT INTO t1(name) SELECT name FROM t1;
48 inc $counter;
49 }
50 --enable_query_log
51
52
53 --let SEARCH_FILE=$MYSQLD_ERROR_LOG
54 --let SEARCH_PATTERN=System tablespace expansion is redo logged
55 --source include/search_pattern.inc
56
57 SET @@GLOBAL.DEBUG='-d,ib_redo_log_system_tablespace_expansion';
58
59 --echo # Verify no issues observed during crash recovery
60 let restart_parameters = restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_ERROR_LOG;
61 --replace_result $MYSQLD_ERROR_LOG temp/mysqld_test.err $MYSQLD_DATADIR tmp/test_data_dir
62 --source include/kill_and_restart_mysqld.inc
63 SELECT * FROM t1 ORDER BY id LIMIT 1;
64 DROP TABLE t1;
65
66 --echo #
67 --echo # Cleanup
68 --echo #
69 let restart_parameters = restart:;
70 --source include/restart_mysqld.inc
71 --remove_file $MYSQLD_ERROR_LOG
72 --force-rmdir $MYSQLD_DATADIR