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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
##
## Tests the auto-increment with binlog in STATEMENT mode.
##
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
##
## Verify the correct operation of the auto-increment when the binlog
## format artificially set to the 'STATEMENT' (although this mode is
## not recommended in the current version):
##
--connection node_2
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
--connection node_1
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
select * from t1;
insert into t1(i) values(null), (null), (null);
select * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
select * from t1;
SET GLOBAL wsrep_forced_binlog_format='none';
--connection node_1
SET GLOBAL wsrep_forced_binlog_format='none';
drop table t1;
##
## Check the operation when the automatic control over the auto-increment
## settings is switched off, that is, when we use the increment step and
## the offset specified by the user. In the current session, the binlog
## format is set to 'STATEMENT'. It is important that the values of the
## auto-increment options does not changed on other node - it allows us
## to check the correct transmission of the auto-increment options to
## other nodes:
##
--disable_warnings
SET SESSION binlog_format='STATEMENT';
--enable_warnings
show variables like 'binlog_format';
SET GLOBAL wsrep_auto_increment_control='OFF';
let $increment_node1 = `SELECT @@session.auto_increment_increment`;
let $offset_node1 = `SELECT @@session.auto_increment_offset`;
SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
select * from t1;
insert into t1(i) values(null), (null), (null);
select * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
select * from t1;
--connection node_1
##
## Verify the return to automatic calculation of the step
## and offset of the auto-increment:
##
SET GLOBAL wsrep_auto_increment_control='ON';
SET SESSION binlog_format='ROW';
show variables like 'binlog_format';
show variables like '%auto_increment%';
##
## Verify the recovery of original user-defined values after
## stopping the automatic control over auto-increment:
##
SET GLOBAL wsrep_auto_increment_control='OFF';
show variables like '%auto_increment%';
##
## Restore original options and drop test table:
##
SET GLOBAL wsrep_auto_increment_control='ON';
drop table t1;
##
## Verify the correct operation of the auto-increment when the binlog
## format set to the 'ROW':
##
--connection node_2
SET GLOBAL wsrep_forced_binlog_format='ROW';
--connection node_1
SET GLOBAL wsrep_forced_binlog_format='ROW';
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
select * from t1;
insert into t1(i) values(null), (null), (null);
select * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
select * from t1;
SET GLOBAL wsrep_forced_binlog_format='none';
--connection node_1
SET GLOBAL wsrep_forced_binlog_format='none';
drop table t1;
##
## Check the operation when the automatic control over the auto-increment
## settings is switched off, that is, when we use the increment step and
## the offset specified by the user. In the current session, the binlog
## format is set to 'ROW'. It is important that the values of the
## auto-increment options does not changed on other node - it allows us
## to check the correct transmission of the auto-increment options to
## other nodes:
##
SET SESSION binlog_format='ROW';
show variables like 'binlog_format';
SET GLOBAL wsrep_auto_increment_control='OFF';
SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text',
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t1(i) values(null);
select * from t1;
insert into t1(i) values(null), (null), (null);
select * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
select * from t1;
--connection node_1
##
## Verify the return to automatic calculation of the step
## and offset of the auto-increment:
##
SET GLOBAL wsrep_auto_increment_control='ON';
show variables like 'binlog_format';
show variables like '%auto_increment%';
##
## Verify the recovery of original user-defined values after
## stopping the automatic control over auto-increment:
##
SET GLOBAL wsrep_auto_increment_control='OFF';
show variables like '%auto_increment%';
##
## Restore original options and drop test table:
##
SET GLOBAL wsrep_auto_increment_control='ON';
drop table t1;
--source include/auto_increment_offset_restore.inc
|