Debian Codegraph @

mysql-test/suite/innodb/t/innodb-index-debug.test

raw
1 -- source include/have_debug.inc
2 -- source include/count_sessions.inc
3 -- source include/have_debug_sync.inc
4
5 let $MYSQLD_DATADIR= `select @@datadir`;
6
7 #########################
8 # how to record this test JSON result content mismatch
9 # If required fix regex patterns in mysql-test/include/ibd2sdi.pl
10 # and mysql-test/suite/innodb/include/ibd2sdi_replace_pattern.inc,
11 # then run the test with --record option.
12 #########################
13
14 #
15 # Test for BUG# 12739098, check whether trx->error_status is reset on error.
16 #
17 CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
18 SHOW CREATE TABLE t1;
19 INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
20
21 SET SESSION DEBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
22 --error ER_TOO_MANY_CONCURRENT_TRXS
23 ALTER TABLE t1 ADD UNIQUE INDEX(c2);
24 SET SESSION DEBUG=DEFAULT;
25
26 SHOW CREATE TABLE t1;
27 DROP TABLE t1;
28
29 #
30 # Test for Bug#13861218 Records are not fully sorted during index creation
31 #
32 CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
33 ENGINE=InnoDB;
34 INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
35 SET DEBUG='+d,ddl_buf_add_two';
36 # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
37 # No crash here, because n_uniq for c2 includes the clustered index fields
38 CREATE UNIQUE INDEX ui ON bug13861218(c1);
39 SET DEBUG='-d,ddl_buf_add_two';
40 DROP TABLE bug13861218;
41
42 CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
43 INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
44 SET DEBUG='+d,ddl_buf_add_two';
45 # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
46 # assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
47 CREATE UNIQUE INDEX ui ON bug13861218(c1);
48 SET DEBUG='-d,ddl_buf_add_two';
49 DROP TABLE bug13861218;
50
51 --echo #
52 --echo # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
53 --echo #
54
55 # Error during file creation in alter operation
56 create table t480(a serial)engine=innodb;
57 insert into t480
58 values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
59 (),(),(),(),(),(),(),();
60 insert into t480 select 0 from t480;
61 insert into t480 select 0 from t480;
62 insert into t480 select 0 from t480;
63 insert into t480 select 0 from t480;
64
65 # Error during file write in alter operation.
66 create table t1(f1 int auto_increment not null,
67 f2 char(200) not null, f3 char(200) not null,
68 primary key(f1,f2,f3), key(f1))engine=innodb charset latin1;
69 insert into t1 select NULL,'aaa','bbb' from t480;
70 insert into t1 select NULL,'aaaa','bbbb' from t480;
71 insert into t1 select NULL,'aaaaa','bbbbb' from t480;
72 insert into t1 select NULL,'aaaaaa','bbbbbb' from t480;
73 SET DEBUG = '+d,ddl_write_failure';
74 --error ER_TEMP_FILE_WRITE_FAILURE
75 alter table t1 drop primary key,add primary key(f2,f1);
76 SET DEBUG = '-d,ddl_write_failure';
77 drop table t1;
78
79 # Optimize table via inplace algorithm
80 connect (con1,localhost,root);
81 create table t1(k1 int auto_increment primary key,
82 k2 char(200),k3 char(200))engine=innodb;
83 insert into t1 values(NULL,'a','b'), (NULL,'aa','bb');
84 SET DEBUG_SYNC= 'ddl_after_scan
85 SIGNAL opened WAIT_FOR flushed';
86 send optimize table t1;
87 connection default;
88 --echo connection default
89 SET DEBUG_SYNC= 'now WAIT_FOR opened';
90 INSERT INTO t1 select NULL,'aaa','bbb' from t480;
91 SET DEBUG_SYNC= 'now SIGNAL flushed';
92 connection con1;
93 --enable_info
94 --echo /*con1 reap*/ Optimize table t1;
95 reap;
96 --disable_info
97 SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3;
98 drop table t1;
99
100 # Log file creation failure.
101 create table t1(k1 int auto_increment primary key,
102 k2 char(200),k3 char(200))engine=innodb;
103 SET DEBUG_SYNC= 'ddl_after_scan
104 SIGNAL opened WAIT_FOR flushed';
105 send ALTER TABLE t1 ADD COLUMN k4 int, ALGORITHM=INPLACE;
106 connection default;
107 --echo connection default
108 SET DEBUG_SYNC= 'now WAIT_FOR opened';
109 SET debug = '+d,row_log_tmpfile_fail';
110 INSERT INTO t1 select NULL,'aaa','bbb' from t480;
111 INSERT INTO t1 select NULL,'aaaa','bbbb' from t480;
112 SET DEBUG_SYNC= 'now SIGNAL flushed';
113 SET debug = '-d,row_log_tmpfile_fail';
114 connection con1;
115 --echo /*con1 reap*/ ALTER TABLE t1 ADD COLUMN k4 int, ALGORITHM=INPLACE;
116 --error ER_OUT_OF_RESOURCES
117 reap;
118 SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3;
119 disconnect con1;
120 connection default;
121 show create table t1;
122
123 SET DEBUG_SYNC='RESET';
124 --source include/wait_until_count_sessions.inc
125 --source include/shutdown_mysqld.inc
126
127 --echo # SDI output shouldn't show new column "k4" because
128 --echo # ALTER failed
129
130 --let $SRC_DIR=$MYSQL_TEST_DIR/std_data/dd/sdi/innodb_index_debug
131
132 # Create a directory to store json generated
133 --let $DEST_DIR=$MYSQL_TMP_DIR/sdi_dest/
134 --error 0,1
135 --force-rmdir $DEST_DIR
136 --mkdir $DEST_DIR
137
138 --let JSON_FILE_PATH = $DEST_DIR/t1.json
139 --exec $IBD2SDI $MYSQLD_DATADIR/test/t1.ibd -d $JSON_FILE_PATH 2>&1
140 --source ../include/ibd2sdi_replace.inc
141 if ($MTR_RECORD == 0) {
142 --diff_files $SRC_DIR/t1.json $JSON_FILE_PATH
143 }
144
145 # If --record is used, save the json files created in the $DEST_DIR
146 # back to the $SRC_DIR.
147 if ($MTR_RECORD == 1) {
148 --copy_files_wildcard $DEST_DIR $SRC_DIR *.json
149 }
150
151 --echo # Remove json files
152 --force-rmdir $DEST_DIR
153
154 --source include/start_mysqld.inc
155 drop table t1;
156 drop table t480;
157 SET DEBUG_SYNC='RESET';
158 --source include/wait_until_count_sessions.inc
159
160 --echo #
161 --echo # BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP
162 --echo # LAST COLUMN OF OLD PK
163 --echo #
164
165 SET debug="+d,innodb_alter_table_pk_assert_no_sort";
166
167 --source suite/innodb/include/alter_table_pk_no_sort.inc
168
169 SET debug="-d,innodb_alter_table_pk_assert_no_sort";