summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb-index-debug.test
blob: e179b969a6a8c297458badfd4f7aaf5c13175ea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_debug_sync.inc

let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';

#
# Test for BUG# 12739098, check whether trx->error_status is reset on error.
#
CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);

SET @saved_debug_dbug = @@SESSION.debug_dbug;
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';
--error ER_TOO_MANY_CONCURRENT_TRXS
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
SET DEBUG_DBUG = @saved_debug_dbug;

SHOW CREATE TABLE t1;
DROP TABLE t1;

#
# Test for Bug#13861218 Records are not fully sorted during index creation
#
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
ENGINE=InnoDB;
INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
# No crash here, because n_uniq for c2 includes the clustered index fields
CREATE UNIQUE INDEX ui ON bug13861218(c1);
SET DEBUG_DBUG = @saved_debug_dbug;
DROP TABLE bug13861218;

CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
# assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
CREATE UNIQUE INDEX ui ON bug13861218(c1);
SET DEBUG_DBUG = @saved_debug_dbug;
DROP TABLE bug13861218;

eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format=$format;
eval set global innodb_file_format_max=$format;

--echo #
--echo # Bug #21762319	ADDING INDEXES ON EMPTY TABLE IS SLOW
--echo #	WITH LARGE INNODB_SORT_BUFFER_SIZE.

call mtr.add_suppression("InnoDB: Cannot create temporary merge file");

# Table with large data which is greater than sort buffer

create table t480(a serial)engine=innodb;
insert into t480
values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
(),(),(),(),(),(),(),();
insert into t480 select 0 from t480;
insert into t480 select 0 from t480;
insert into t480 select 0 from t480;
insert into t480 select 0 from t480;
create table t1(f1 int auto_increment not null,
		f2 char(200) not null, f3 char(200) not null,
		f4 char(200) not null,primary key(f1))engine=innodb;
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
insert into t1 select NULL,'aaaa','bbbb','cccc' from t480;
insert into t1 select NULL,'aaaaa','bbbbb','ccccc' from t480;
insert into t1 select NULL,'aaaaaa','bbbbbb','cccccc' from t480;
insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480;
insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
select count(*) from t1;

SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure';
--error ER_OUT_OF_RESOURCES
alter table t1 force, algorithm=inplace;
SET DEBUG_DBUG = @saved_debug_dbug;
drop table t1, t480;

--echo #
--echo # MDEV-12827 Assertion failure when reporting duplicate key error
--echo # in online table rebuild
--echo #

CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB;
--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
--send
ALTER TABLE t1 DROP j, FORCE;

--connection default
SET DEBUG_SYNC='now WAIT_FOR built';
--error ER_DUP_ENTRY
INSERT INTO t1 (i) VALUES (0),(0);
SET DEBUG_SYNC='now SIGNAL log';

--connection con1
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
--send
ALTER TABLE t1 DROP j, FORCE;

--connection default
SET DEBUG_SYNC='now WAIT_FOR built2';
INSERT INTO t1 (i) VALUES (0),(1);
--error ER_DUP_ENTRY
UPDATE t1 SET i=0;
SET DEBUG_SYNC='now SIGNAL log2';

--connection con1
--error ER_DUP_ENTRY
reap;
--disconnect con1
--connection default
SET DEBUG_SYNC='RESET';
DROP TABLE t1;