Debian Codegraph @

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

raw
1 ##########################################################################
2 # Test script to test index_log_version for table having INSTANT ADD/DROP
3 # columns.
4 #
5 # This test is to be run in debug mode only and with debug flag
6 ##########################################################################
7
8 --source include/have_debug.inc
9
10 --echo # --------
11 --echo # Startup
12 --echo # --------
13
14 --let MYSQLD_DATADIR=`select @@datadir`
15
16 CREATE TABLE t1 (C1 CHAR(10), C2 CHAR(10));
17 INSERT INTO t1 VALUES ("r1c1", "r1c2");
18 ALTER TABLE t1 ADD COLUMN C3 CHAR(10) FIRST, ALGORITHM=INSTANT;
19
20 # Slow shutdown and restart to make sure ibuf merge is finished
21 SET GLOBAL innodb_fast_shutdown = 0;
22 --source include/shutdown_mysqld.inc
23
24 --echo # Take backup of original datadir
25 --let BACKUP=$MYSQL_TMP_DIR/datadir_backup
26 --mkdir $BACKUP
27 --force-cpdir $MYSQLD_DATADIR $BACKUP
28
29 --let SEARCH_FILE=$BACKUP/my_restart.err
30
31 --echo # restart mysqld on backup datadir
32 --let $restart_parameters = restart: --datadir=$BACKUP/data --log-error=$SEARCH_FILE
33 --replace_result $BACKUP BACKUP
34 --source include/start_mysqld.inc
35
36 # Make sure pages are not flushed and checkpoint is not moved so that REDOs are
37 # applied at restart
38 --source ../include/log_disable_page_cleaners.inc
39
40 # Let the wrong version be written when index is being logged
41 SET SESSION debug="+d,invalid_index_log_version";
42
43 # DML to have some REDOs with index logged
44 UPDATE t1 SET C2 = "r1c22";
45
46 --source include/kill_mysqld.inc
47
48 --echo # start mysqld. It should crash with error
49 --replace_result $BACKUP BACKUP
50 --error 2,42,-2147483645
51 --exec $MYSQLD_CMD $MYSQLD_ARGS --datadir=$BACKUP/data --log-error=$SEARCH_FILE
52
53 --let SEARCH_PATTERN=Index log version [0-9]+ did not match. Max index version is [0-9]+. Recovery can't continue. Please make sure server is not starting up with the datadir generated in future version.
54 --echo # Expect found
55 --source include/search_pattern.inc
56 --remove_file $SEARCH_FILE
57
58 --echo # restart mysqld normally
59 --let $restart_parameters = restart:
60 --source include/start_mysqld_no_echo.inc
61
62 SELECT * FROM t1;
63
64 --echo # --------
65 --echo # Cleanup
66 --echo # --------
67 DROP TABLE t1;
68 --force-rmdir $BACKUP