Skip to content

Commit 66d93a8

Browse files
author
Jan Lindström
committed
MDEV-19959 : Galera test failure on galera_binlog_stmt_autoinc
Make sure that nodes have correct auto_increment_offset when they start and when control is turned on.
1 parent 79660e5 commit 66d93a8

File tree

3 files changed

+102
-61
lines changed

3 files changed

+102
-61
lines changed

mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
connection node_1;
2+
SET GLOBAL auto_increment_offset=1;
3+
connection node_2;
4+
SET GLOBAL auto_increment_offset=2;
5+
connection node_1;
26
connection node_2;
37
connection node_2;
48
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
59
connection node_1;
610
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
711
CREATE TABLE t1 (
8-
i int(11) NOT NULL AUTO_INCREMENT,
9-
c char(32) DEFAULT 'dummy_text',
10-
PRIMARY KEY (i)
12+
i int(11) NOT NULL primary key AUTO_INCREMENT,
13+
c char(32) DEFAULT 'dummy_text'
1114
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
15+
show variables like 'auto_increment%';
16+
Variable_name Value
17+
auto_increment_increment 2
18+
auto_increment_offset 1
1219
insert into t1(i) values(null);
13-
select * from t1;
20+
select * from t1 order by i;
1421
i c
1522
1 dummy_text
1623
insert into t1(i) values(null), (null), (null);
17-
select * from t1;
24+
select * from t1 order by i;
1825
i c
1926
1 dummy_text
2027
3 dummy_text
2128
5 dummy_text
2229
7 dummy_text
2330
connection node_2;
24-
select * from t1;
31+
show variables like 'auto_increment%';
32+
Variable_name Value
33+
auto_increment_increment 2
34+
auto_increment_offset 2
35+
select * from t1 order by i;
2536
i c
2637
1 dummy_text
2738
3 dummy_text
@@ -39,23 +50,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF';
3950
SET SESSION auto_increment_increment = 3;
4051
SET SESSION auto_increment_offset = 1;
4152
CREATE TABLE t1 (
42-
i int(11) NOT NULL AUTO_INCREMENT,
43-
c char(32) DEFAULT 'dummy_text',
44-
PRIMARY KEY (i)
53+
i int(11) NOT NULL primary key AUTO_INCREMENT,
54+
c char(32) DEFAULT 'dummy_text'
4555
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
56+
show variables like 'auto_increment%';
57+
Variable_name Value
58+
auto_increment_increment 3
59+
auto_increment_offset 1
4660
insert into t1(i) values(null);
47-
select * from t1;
61+
select * from t1 order by i;
4862
i c
4963
1 dummy_text
5064
insert into t1(i) values(null), (null), (null);
51-
select * from t1;
65+
select * from t1 order by i;
5266
i c
5367
1 dummy_text
5468
4 dummy_text
5569
7 dummy_text
5670
10 dummy_text
5771
connection node_2;
58-
select * from t1;
72+
show variables like 'auto_increment%';
73+
Variable_name Value
74+
auto_increment_increment 2
75+
auto_increment_offset 2
76+
select * from t1 order by i;
5977
i c
6078
1 dummy_text
6179
4 dummy_text
@@ -64,6 +82,7 @@ i c
6482
connection node_1;
6583
SET GLOBAL wsrep_auto_increment_control='ON';
6684
SET SESSION binlog_format='ROW';
85+
connection node_1;
6786
show variables like 'binlog_format';
6887
Variable_name Value
6988
binlog_format ROW
@@ -79,29 +98,37 @@ auto_increment_increment 3
7998
auto_increment_offset 1
8099
wsrep_auto_increment_control OFF
81100
SET GLOBAL wsrep_auto_increment_control='ON';
101+
connection node_1;
82102
drop table t1;
83103
connection node_2;
84104
SET GLOBAL wsrep_forced_binlog_format='ROW';
85105
connection node_1;
86106
SET GLOBAL wsrep_forced_binlog_format='ROW';
87107
CREATE TABLE t1 (
88-
i int(11) NOT NULL AUTO_INCREMENT,
89-
c char(32) DEFAULT 'dummy_text',
90-
PRIMARY KEY (i)
108+
i int(11) NOT NULL primary key AUTO_INCREMENT,
109+
c char(32) DEFAULT 'dummy_text'
91110
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
111+
show variables like 'auto_increment%';
112+
Variable_name Value
113+
auto_increment_increment 2
114+
auto_increment_offset 1
92115
insert into t1(i) values(null);
93-
select * from t1;
116+
select * from t1 order by i;
94117
i c
95118
1 dummy_text
96119
insert into t1(i) values(null), (null), (null);
97-
select * from t1;
120+
select * from t1 order by i;
98121
i c
99122
1 dummy_text
100123
3 dummy_text
101124
5 dummy_text
102125
7 dummy_text
103126
connection node_2;
104-
select * from t1;
127+
show variables like 'auto_increment%';
128+
Variable_name Value
129+
auto_increment_increment 2
130+
auto_increment_offset 2
131+
select * from t1 order by i;
105132
i c
106133
1 dummy_text
107134
3 dummy_text
@@ -119,23 +146,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF';
119146
SET SESSION auto_increment_increment = 3;
120147
SET SESSION auto_increment_offset = 1;
121148
CREATE TABLE t1 (
122-
i int(11) NOT NULL AUTO_INCREMENT,
123-
c char(32) DEFAULT 'dummy_text',
124-
PRIMARY KEY (i)
149+
i int(11) NOT NULL primary key AUTO_INCREMENT,
150+
c char(32) DEFAULT 'dummy_text'
125151
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
152+
show variables like 'auto_increment%';
153+
Variable_name Value
154+
auto_increment_increment 3
155+
auto_increment_offset 1
126156
insert into t1(i) values(null);
127-
select * from t1;
157+
select * from t1 order by i;
128158
i c
129159
1 dummy_text
130160
insert into t1(i) values(null), (null), (null);
131-
select * from t1;
161+
select * from t1 order by i;
132162
i c
133163
1 dummy_text
134164
4 dummy_text
135165
7 dummy_text
136166
10 dummy_text
137167
connection node_2;
138-
select * from t1;
168+
show variables like 'auto_increment%';
169+
Variable_name Value
170+
auto_increment_increment 2
171+
auto_increment_offset 2
172+
select * from t1 order by i;
139173
i c
140174
1 dummy_text
141175
4 dummy_text
@@ -149,13 +183,13 @@ binlog_format ROW
149183
show variables like '%auto_increment%';
150184
Variable_name Value
151185
auto_increment_increment 2
152-
auto_increment_offset 1
186+
auto_increment_offset 2
153187
wsrep_auto_increment_control ON
154188
SET GLOBAL wsrep_auto_increment_control='OFF';
155189
show variables like '%auto_increment%';
156190
Variable_name Value
157-
auto_increment_increment 3
158-
auto_increment_offset 1
191+
auto_increment_increment 1
192+
auto_increment_offset 2
159193
wsrep_auto_increment_control OFF
160194
SET GLOBAL wsrep_auto_increment_control='ON';
161195
drop table t1;

mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[mysqld.1]
44
auto_increment_offset=1
5+
auto_increment_increment=1
56

67
[mysqld.2]
78
auto_increment_offset=2
9+
auto_increment_increment=1

mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
##
44

55
--source include/galera_cluster.inc
6-
--source include/have_innodb.inc
6+
--source include/force_restart.inc
7+
8+
--connection node_1
9+
SET GLOBAL auto_increment_offset=1;
10+
--connection node_2
11+
SET GLOBAL auto_increment_offset=2;
712

813
--let $node_1=node_1
914
--let $node_2=node_2
@@ -22,23 +27,24 @@ SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
2227
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
2328

2429
CREATE TABLE t1 (
25-
i int(11) NOT NULL AUTO_INCREMENT,
26-
c char(32) DEFAULT 'dummy_text',
27-
PRIMARY KEY (i)
30+
i int(11) NOT NULL primary key AUTO_INCREMENT,
31+
c char(32) DEFAULT 'dummy_text'
2832
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2933

34+
show variables like 'auto_increment%';
3035
insert into t1(i) values(null);
3136

32-
select * from t1;
37+
select * from t1 order by i;
3338

3439
insert into t1(i) values(null), (null), (null);
3540

36-
select * from t1;
41+
select * from t1 order by i;
3742

3843
--connection node_2
3944
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
4045
--source include/wait_condition.inc
41-
select * from t1;
46+
show variables like 'auto_increment%';
47+
select * from t1 order by i;
4248

4349
SET GLOBAL wsrep_forced_binlog_format='none';
4450

@@ -72,36 +78,31 @@ SET SESSION auto_increment_increment = 3;
7278
SET SESSION auto_increment_offset = 1;
7379

7480
CREATE TABLE t1 (
75-
i int(11) NOT NULL AUTO_INCREMENT,
76-
c char(32) DEFAULT 'dummy_text',
77-
PRIMARY KEY (i)
81+
i int(11) NOT NULL primary key AUTO_INCREMENT,
82+
c char(32) DEFAULT 'dummy_text'
7883
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
7984

85+
show variables like 'auto_increment%';
8086
insert into t1(i) values(null);
8187

82-
select * from t1;
88+
select * from t1 order by i;
8389

8490
insert into t1(i) values(null), (null), (null);
8591

86-
select * from t1;
92+
select * from t1 order by i;
8793

8894
--connection node_2
8995
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
9096
--source include/wait_condition.inc
97+
show variables like 'auto_increment%';
9198

92-
select * from t1;
99+
select * from t1 order by i;
93100

94101
--connection node_1
95-
96-
##
97-
## Verify the return to automatic calculation of the step
98-
## and offset of the auto-increment:
99-
##
100-
101102
SET GLOBAL wsrep_auto_increment_control='ON';
102-
103103
SET SESSION binlog_format='ROW';
104-
104+
--source include/auto_increment_offset_restore.inc
105+
--connection node_1
105106
show variables like 'binlog_format';
106107
show variables like '%auto_increment%';
107108

@@ -119,7 +120,8 @@ show variables like '%auto_increment%';
119120
##
120121

121122
SET GLOBAL wsrep_auto_increment_control='ON';
122-
123+
--source include/auto_increment_offset_restore.inc
124+
--connection node_1
123125
drop table t1;
124126

125127
##
@@ -134,24 +136,25 @@ SET GLOBAL wsrep_forced_binlog_format='ROW';
134136
SET GLOBAL wsrep_forced_binlog_format='ROW';
135137

136138
CREATE TABLE t1 (
137-
i int(11) NOT NULL AUTO_INCREMENT,
138-
c char(32) DEFAULT 'dummy_text',
139-
PRIMARY KEY (i)
139+
i int(11) NOT NULL primary key AUTO_INCREMENT,
140+
c char(32) DEFAULT 'dummy_text'
140141
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
141142

143+
show variables like 'auto_increment%';
142144
insert into t1(i) values(null);
143145

144-
select * from t1;
146+
select * from t1 order by i;
145147

146148
insert into t1(i) values(null), (null), (null);
147149

148-
select * from t1;
150+
select * from t1 order by i;
149151

150152
--connection node_2
151153
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
152154
--source include/wait_condition.inc
153155

154-
select * from t1;
156+
show variables like 'auto_increment%';
157+
select * from t1 order by i;
155158

156159
SET GLOBAL wsrep_forced_binlog_format='none';
157160

@@ -181,24 +184,25 @@ SET SESSION auto_increment_increment = 3;
181184
SET SESSION auto_increment_offset = 1;
182185

183186
CREATE TABLE t1 (
184-
i int(11) NOT NULL AUTO_INCREMENT,
185-
c char(32) DEFAULT 'dummy_text',
186-
PRIMARY KEY (i)
187+
i int(11) NOT NULL primary key AUTO_INCREMENT,
188+
c char(32) DEFAULT 'dummy_text'
187189
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
188190

191+
show variables like 'auto_increment%';
189192
insert into t1(i) values(null);
190193

191-
select * from t1;
194+
select * from t1 order by i;
192195

193196
insert into t1(i) values(null), (null), (null);
194197

195-
select * from t1;
198+
select * from t1 order by i;
196199

197200
--connection node_2
198201
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
199202
--source include/wait_condition.inc
203+
show variables like 'auto_increment%';
200204

201-
select * from t1;
205+
select * from t1 order by i;
202206

203207
--connection node_1
204208

@@ -208,6 +212,7 @@ select * from t1;
208212
##
209213

210214
SET GLOBAL wsrep_auto_increment_control='ON';
215+
--source include/auto_increment_offset_restore.inc
211216

212217
show variables like 'binlog_format';
213218
show variables like '%auto_increment%';

0 commit comments

Comments
 (0)