Debian Codegraph @

mysql-test/suite/innodb/include/instant_ddl_recovery.inc

raw
1 ##########################################################################
2 # Test script to test RECOVERY for table having INSTANT
3 # ADD/DROP columns.
4 #
5 # $row_format is to be set to the row_format on which test is to be run.
6 ##########################################################################
7
8 --echo # ------------------------------------------------------------
9 --echo # Create a table with 3 columns. [id, c1, c2]
10 --echo # ------------------------------------------------------------
11 --eval CREATE TABLE t1(id INT PRIMARY KEY, c1 CHAR(10), c2 CHAR(10)) ROW_FORMAT=$row_format;
12 --let $table_name=t1
13 --source suite/innodb/include/print_instant_metadata.inc
14
15 INSERT INTO t1 VALUES (1, "r1c1", "r1c2");
16 SELECT * FROM t1;
17
18 --echo # INSTANT ADD a column
19 Alter table t1 add column c3 char(10), algorithm=instant;
20 --let $table_name=t1
21 --source suite/innodb/include/print_instant_metadata.inc
22 INSERT INTO t1 VALUES (2, "r2c1", "r2c2", "r2c3");
23 SELECT * FROM t1;
24
25 --echo # INSTANT DROP a column
26 Alter table t1 drop column c2 , algorithm=instant;
27 --let $table_name=t1
28 --source suite/innodb/include/print_instant_metadata.inc
29 INSERT INTO t1 VALUES (3, "r3c1", "r3c3");
30 SELECT * FROM t1;
31
32 --echo # Make sure nothing gets flushed on disk
33 SET GLOBAL innodb_log_checkpoint_now = ON;
34 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
35 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
36 SET GLOBAL innodb_master_thread_disabled_debug = 1;
37
38 --echo # Make inplace update
39 UPDATE t1 SET c1="r0c0";
40
41 --echo # Make not-inplace update
42 UPDATE t1 SET c3="r1c3" WHERE id=1;
43
44 --echo # Insert a new record
45 INSERT INTO t1 VALUES (4, "r4c1", "r4c3");
46
47 --echo # Delete a record
48 DELETE FROM t1 WHERE id=2;
49
50 # kill and restart the server
51 --source include/kill_and_restart_mysqld.inc
52
53 #restart the server
54
55 --let $table_name=t1
56 --source suite/innodb/include/print_instant_metadata.inc
57
58 SELECT * FROM t1;
59
60 --echo ###########
61 --echo # CLEANUP #
62 --echo ###########
63 DROP TABLE t1;
64
65 #
66 # Bug#35183686 ALTER_STORED_COLUMN_ORDER with algorithm=INSTANT makes wrong INSERT REDO log
67 #
68 --eval CREATE TABLE t1 (`c` text, `b` blob NOT NULL, `nc03242` longblob, `d` int DEFAULT NULL, UNIQUE KEY `b` (`b`(99))) ENGINE=InnoDB ROW_FORMAT=$row_format
69
70 alter table t1
71 change c c text after d,
72 add column nc05984 bool,
73 algorithm=instant;
74
75 SET GLOBAL innodb_log_checkpoint_now = ON;
76 SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
77 SET GLOBAL innodb_dict_stats_disabled_debug = 1;
78 SET GLOBAL innodb_master_thread_disabled_debug = 1;
79
80 INSERT INTO t1 SET b='ulccclraaacaucrouorouoooolrlo', d=6;
81
82 --source include/kill_and_restart_mysqld.inc
83
84 SELECT * FROM t1;
85
86 DROP TABLE t1;