Skip to content

Commit a729656

Browse files
author
Jan Lindström
committed
MDEV-10548: Some of the debug sync waits do not work with InnoDB 5.7 (branch bb-10.2-jan)
Fixed auto_increment_dup test. Current behavior is correct for repeatable read (and serializable) isolation levels. Old behavior is correct for read committed isolation level.
1 parent da168b3 commit a729656

File tree

6 files changed

+280
-4
lines changed

6 files changed

+280
-4
lines changed

mysql-test/suite/encryption/disabled.def

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313
innodb_scrub : MDEV-8139
1414
innodb_scrub_compressed : MDEV-8139
1515
innodb_scrub_background : MDEV-8139
16-
innodb_encryption-page-compression : Fails with lost connection at line 156
17-
innochecksum : Waiting for merge
18-
16+
innochecksum : MDEV-10727
17+
innodb_encryption_discard_import : MDEV-9099

mysql-test/suite/encryption/r/innodb_encryption-page-compression.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
SET GLOBAL innodb_file_format = `Barracuda`;
2+
Warnings:
3+
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
24
SET GLOBAL innodb_file_per_table = ON;
35
SET GLOBAL innodb_encryption_threads = 4;
46
SET GLOBAL innodb_encrypt_tables = on;
@@ -262,3 +264,5 @@ drop table innodb_page_compressed6;
262264
drop table innodb_page_compressed7;
263265
drop table innodb_page_compressed8;
264266
drop table innodb_page_compressed9;
267+
Warnings:
268+
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html

mysql-test/suite/innodb/disabled.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@
1010
#
1111
##############################################################################
1212

13-
innodb.auto_increment_dup : MDEV-10548
1413
innodb_defragment_fill_factor : MDEV-10771

mysql-test/suite/innodb/r/auto_increment_dup.result

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,137 @@
11
drop table if exists t1;
2+
set global transaction isolation level repeatable read;
3+
CREATE TABLE t1(
4+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
5+
k INT,
6+
c CHAR(1),
7+
UNIQUE KEY(k)) ENGINE=InnoDB;
8+
SHOW CREATE TABLE t1;
9+
Table Create Table
10+
t1 CREATE TABLE `t1` (
11+
`id` int(11) NOT NULL AUTO_INCREMENT,
12+
`k` int(11) DEFAULT NULL,
13+
`c` char(1) DEFAULT NULL,
14+
PRIMARY KEY (`id`),
15+
UNIQUE KEY `k` (`k`)
16+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
17+
#
18+
# Sequential execution
19+
#
20+
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
21+
affected rows: 3
22+
info: Records: 3 Duplicates: 0 Warnings: 0
23+
#
24+
# 1 duplicate
25+
#
26+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
27+
affected rows: 4
28+
info: Records: 3 Duplicates: 1 Warnings: 0
29+
#
30+
# 5 rows, consecutive auto_inc values
31+
#
32+
SELECT * FROM t1 order by k;
33+
id k c
34+
1 1 NULL
35+
2 2 2
36+
3 3 NULL
37+
4 4 NULL
38+
5 5 NULL
39+
affected rows: 5
40+
DROP TABLE t1;
41+
affected rows: 0
42+
CREATE TABLE t1(
43+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
44+
k INT,
45+
c CHAR(1),
46+
UNIQUE KEY(k)) ENGINE=InnoDB;
47+
affected rows: 0
48+
#
49+
# Sequential execution 2
50+
#
51+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
52+
affected rows: 3
53+
info: Records: 3 Duplicates: 0 Warnings: 0
54+
#
55+
# 1 duplicate
56+
#
57+
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
58+
affected rows: 4
59+
info: Records: 3 Duplicates: 1 Warnings: 0
60+
#
61+
# 5 rows, consecutive auto_inc values
62+
#
63+
SELECT * FROM t1 order by k;
64+
id k c
65+
4 1 NULL
66+
1 2 1
67+
5 3 NULL
68+
2 4 NULL
69+
3 5 NULL
70+
affected rows: 5
71+
DROP TABLE t1;
72+
affected rows: 0
73+
CREATE TABLE t1(
74+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
75+
k INT,
76+
c CHAR(1),
77+
UNIQUE KEY(k)) ENGINE=InnoDB;
78+
affected rows: 0
79+
#
80+
# Parallel execution
81+
#
82+
connect con1, localhost, root;
83+
connect con2, localhost, root;
84+
connection con1;
85+
#
86+
# Connection 1
87+
#
88+
SET DEBUG_SYNC=IF(@@innodb_autoinc_lock_mode > 0, 'ha_write_row_end WAIT_FOR continue', 'RESET');
89+
affected rows: 0
90+
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
91+
connection con2;
92+
#
93+
# Connection 2
94+
#
95+
SET DEBUG_SYNC=IF(@@innodb_autoinc_lock_mode > 0, 'execute_command_after_close_tables SIGNAL continue', 'RESET');
96+
affected rows: 0
97+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
98+
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
99+
connection con1;
100+
#
101+
# 2 duplicates
102+
#
103+
affected rows: 3
104+
info: Records: 3 Duplicates: 0 Warnings: 0
105+
connection default;
106+
#
107+
# 3 rows
108+
#
109+
SELECT * FROM t1 order by k;
110+
id k c
111+
1 1 NULL
112+
2 2 NULL
113+
3 3 NULL
114+
affected rows: 3
115+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
116+
affected rows: 4
117+
info: Records: 3 Duplicates: 1 Warnings: 0
118+
SELECT * FROM t1 order by k;
119+
id k c
120+
1 1 NULL
121+
2 2 2
122+
3 3 NULL
123+
7 4 NULL
124+
8 5 NULL
125+
affected rows: 5
126+
disconnect con1;
127+
disconnect con2;
128+
connection default;
129+
DROP TABLE t1;
130+
#
131+
# Parallel test with read_committed
132+
#
133+
set global transaction isolation level read committed;
134+
drop table if exists t1;
2135
CREATE TABLE t1(
3136
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
4137
k INT,
@@ -7,10 +140,16 @@ UNIQUE KEY(k)) ENGINE=InnoDB;
7140
connect con1, localhost, root;
8141
connect con2, localhost, root;
9142
connection con1;
143+
#
144+
# Connection 1
145+
#
10146
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
11147
affected rows: 0
12148
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
13149
connection con2;
150+
#
151+
# Connection 2
152+
#
14153
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
15154
affected rows: 0
16155
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
@@ -22,6 +161,9 @@ connection con1;
22161
affected rows: 4
23162
info: Records: 3 Duplicates: 1 Warnings: 0
24163
SET DEBUG_SYNC='RESET';
164+
#
165+
# 5 rows, gap in autoinc values
166+
#
25167
SELECT * FROM t1 ORDER BY k;
26168
id k c
27169
1 1 NULL
@@ -33,3 +175,4 @@ disconnect con1;
33175
disconnect con2;
34176
connection default;
35177
DROP TABLE t1;
178+
set global transaction isolation level repeatable read;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--innodb_autoinc_lock_mode=1
2+
--innodb_lock_wait_timeout=2

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

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,146 @@
1010
drop table if exists t1;
1111
--enable_warnings
1212

13+
set global transaction isolation level repeatable read;
14+
1315
CREATE TABLE t1(
1416
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
1517
k INT,
1618
c CHAR(1),
1719
UNIQUE KEY(k)) ENGINE=InnoDB;
1820

21+
SHOW CREATE TABLE t1;
22+
1923
--enable_info
2024

25+
--echo #
26+
--echo # Sequential execution
27+
--echo #
28+
29+
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
30+
31+
--echo #
32+
--echo # 1 duplicate
33+
--echo #
34+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
35+
--echo #
36+
--echo # 5 rows, consecutive auto_inc values
37+
--echo #
38+
39+
SELECT * FROM t1 order by k;
40+
41+
DROP TABLE t1;
42+
43+
CREATE TABLE t1(
44+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
45+
k INT,
46+
c CHAR(1),
47+
UNIQUE KEY(k)) ENGINE=InnoDB;
48+
49+
--echo #
50+
--echo # Sequential execution 2
51+
--echo #
52+
53+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
54+
55+
--echo #
56+
--echo # 1 duplicate
57+
--echo #
58+
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
59+
--echo #
60+
--echo # 5 rows, consecutive auto_inc values
61+
--echo #
62+
63+
SELECT * FROM t1 order by k;
64+
65+
DROP TABLE t1;
66+
67+
CREATE TABLE t1(
68+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
69+
k INT,
70+
c CHAR(1),
71+
UNIQUE KEY(k)) ENGINE=InnoDB;
72+
73+
--echo #
74+
--echo # Parallel execution
75+
--echo #
76+
2177
--connect(con1, localhost, root)
2278
--connect(con2, localhost, root)
2379

2480
--connection con1
81+
--echo #
82+
--echo # Connection 1
83+
--echo #
84+
SET DEBUG_SYNC=IF(@@innodb_autoinc_lock_mode > 0, 'ha_write_row_end WAIT_FOR continue', 'RESET');
85+
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
86+
--connection con2
87+
--echo #
88+
--echo # Connection 2
89+
--echo #
90+
SET DEBUG_SYNC=IF(@@innodb_autoinc_lock_mode > 0, 'execute_command_after_close_tables SIGNAL continue', 'RESET');
91+
--error 1205
92+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
93+
94+
--connection con1
95+
--echo #
96+
--echo # 2 duplicates
97+
--echo #
98+
--reap
99+
--connection default
100+
--echo #
101+
--echo # 3 rows
102+
--echo #
103+
104+
SELECT * FROM t1 order by k;
25105

106+
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
107+
108+
SELECT * FROM t1 order by k;
109+
110+
111+
--disable_info
112+
113+
--disconnect con1
114+
--disconnect con2
115+
116+
--connection default
117+
118+
DROP TABLE t1;
119+
120+
--echo #
121+
--echo # Parallel test with read_committed
122+
--echo #
123+
124+
set global transaction isolation level read committed;
125+
126+
--disable_warnings
127+
drop table if exists t1;
128+
--enable_warnings
129+
130+
CREATE TABLE t1(
131+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
132+
k INT,
133+
c CHAR(1),
134+
UNIQUE KEY(k)) ENGINE=InnoDB;
135+
136+
--enable_info
137+
138+
--connect(con1, localhost, root)
139+
--connect(con2, localhost, root)
140+
141+
--connection con1
142+
143+
--echo #
144+
--echo # Connection 1
145+
--echo #
26146
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
27147
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
28148

29149
--connection con2
150+
--echo #
151+
--echo # Connection 2
152+
--echo #
30153
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
31154
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
32155
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
@@ -35,6 +158,10 @@ INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
35158
--reap
36159
--disable_info
37160
SET DEBUG_SYNC='RESET';
161+
162+
--echo #
163+
--echo # 5 rows, gap in autoinc values
164+
--echo #
38165
SELECT * FROM t1 ORDER BY k;
39166

40167
--disconnect con1
@@ -43,3 +170,6 @@ SELECT * FROM t1 ORDER BY k;
43170
--connection default
44171

45172
DROP TABLE t1;
173+
174+
set global transaction isolation level repeatable read;
175+

0 commit comments

Comments
 (0)