Debian Codegraph @

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

raw
1 -- source include/have_debug.inc
2 -- source include/have_innodb.inc
3 -- source include/count_sessions.inc
4 -- source include/have_debug_sync.inc
5 # This test is slow on buildbot.
6 --source include/big_test.inc
7
8 let $MYSQLD_DATADIR= `select @@datadir`;
9 SET GLOBAL innodb_max_purge_lag_wait=0;
10 connect (stop_purge,localhost,root);
11 START TRANSACTION WITH CONSISTENT SNAPSHOT;
12 connection default;
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 @saved_debug_dbug = @@SESSION.debug_dbug;
22 SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
23 --error ER_TOO_MANY_CONCURRENT_TRXS
24 ALTER TABLE t1 ADD UNIQUE INDEX(c2);
25 SET DEBUG_DBUG = @saved_debug_dbug;
26
27 SHOW CREATE TABLE t1;
28 DROP TABLE t1;
29
30 #
31 # Test for Bug#13861218 Records are not fully sorted during index creation
32 #
33 CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
34 ENGINE=InnoDB;
35 INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
36 SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
37 # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
38 # No crash here, because n_uniq for c2 includes the clustered index fields
39 CREATE UNIQUE INDEX ui ON bug13861218(c1);
40 SET DEBUG_DBUG = @saved_debug_dbug;
41 DROP TABLE bug13861218;
42
43 CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
44 INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
45 SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
46 # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
47 # assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
48 CREATE UNIQUE INDEX ui ON bug13861218(c1);
49 SET DEBUG_DBUG = @saved_debug_dbug;
50 DROP TABLE bug13861218;
51
52 --echo #
53 --echo # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
54 --echo #
55
56 # Error during file creation in alter operation
57 create table t480(a serial)engine=innodb;
58 insert into t480
59 values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
60 (),(),(),(),(),(),(),();
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 insert into t480 select 0 from t480;
65
66 # Error during file write in alter operation.
67 create table t1(f1 int auto_increment not null,
68 f2 char(200) not null, f3 char(200) not null,
69 primary key(f1,f2,f3), key(f1))engine=innodb;
70 insert into t1 select NULL,'aaa','bbb' from t480;
71 insert into t1 select NULL,'aaaa','bbbb' from t480;
72 insert into t1 select NULL,'aaaaa','bbbbb' from t480;
73 insert into t1 select NULL,'aaaaaa','bbbbbb' from t480;
74 SET DEBUG_DBUG = '+d,row_merge_write_failure';
75 --error ER_TEMP_FILE_WRITE_FAILURE
76 alter table t1 drop primary key,add primary key(f2,f1);
77 SET DEBUG_DBUG = @saved_debug_dbug;
78 drop table t1;
79
80 # Optimize table via inplace algorithm
81 connect (con1,localhost,root);
82 create table t1(k1 int auto_increment primary key,
83 k2 char(200),k3 char(200))engine=innodb;
84 insert into t1 values(NULL,'a','b'), (NULL,'aa','bb');
85 SET DEBUG_SYNC= 'row_merge_after_scan
86 SIGNAL opened WAIT_FOR flushed';
87 send optimize table t1;
88 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 INSERT INTO t1 VALUES(1, "test", "test");
104 SET DEBUG_SYNC= 'row_merge_after_scan
105 SIGNAL opened WAIT_FOR flushed';
106 send ALTER TABLE t1 FORCE, ADD COLUMN k4 int;
107 connection default;
108 SET DEBUG_SYNC= 'now WAIT_FOR opened';
109 SET debug_dbug = '+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_DBUG = @saved_debug_dbug;
114 connection con1;
115 --echo /*con1 reap*/ ALTER TABLE t1 ADD COLUMN k4 int;
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 drop table t1;
123 drop table t480;
124 --echo #
125 --echo # MDEV-12827 Assertion failure when reporting duplicate key error
126 --echo # in online table rebuild
127 --echo #
128
129 CREATE TABLE t1 (j INT UNIQUE, i INT) ENGINE=InnoDB;
130 INSERT INTO t1 VALUES(2, 2);
131 --connect (con1,localhost,root,,test)
132 SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
133 --send
134 ALTER TABLE t1 DROP j, ADD UNIQUE INDEX(i), FORCE;
135
136 --connection default
137 SET DEBUG_SYNC='now WAIT_FOR built';
138 SET DEBUG_DBUG='+d,row_ins_row_level';
139 INSERT INTO t1 (i) VALUES (0),(0);
140 SET DEBUG_SYNC='now SIGNAL log';
141 SET DEBUG_DBUG=@saved_debug_dbug;
142
143 --connection con1
144 --error ER_DUP_ENTRY
145 reap;
146 DELETE FROM t1;
147 ALTER TABLE t1 ADD UNIQUE INDEX(i);
148 SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
149 --send
150 ALTER TABLE t1 DROP j, FORCE;
151
152 --connection default
153 SET DEBUG_SYNC='now WAIT_FOR built2';
154 INSERT INTO t1 (i) VALUES (0),(1);
155 --error ER_DUP_ENTRY
156 UPDATE t1 SET i=0;
157 SET DEBUG_SYNC='now SIGNAL log2';
158
159 --connection con1
160 reap;
161 --disconnect con1
162 --disconnect stop_purge
163 --connection default
164 SET DEBUG_SYNC='RESET';
165 DROP TABLE t1;
166
167 SET DEBUG_SYNC='RESET';
168 --source include/wait_until_count_sessions.inc
169
170 --echo #
171 --echo # BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP
172 --echo # LAST COLUMN OF OLD PK
173 --echo #
174
175 SET DEBUG_DBUG = '+d,innodb_alter_table_pk_assert_no_sort';
176
177 --source suite/innodb/include/alter_table_pk_no_sort.inc
178
179 SET DEBUG_DBUG = @saved_debug_dbug;