Commit 66d93a80 authored by Jan Lindström's avatar Jan Lindström

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.
parent 79660e59
connection node_1; connection node_1;
SET GLOBAL auto_increment_offset=1;
connection node_2;
SET GLOBAL auto_increment_offset=2;
connection node_1;
connection node_2; connection node_2;
connection node_2; connection node_2;
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
connection node_1; connection node_1;
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 1
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
3 dummy_text 3 dummy_text
5 dummy_text 5 dummy_text
7 dummy_text 7 dummy_text
connection node_2; connection node_2;
select * from t1; show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 2
select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
3 dummy_text 3 dummy_text
...@@ -39,23 +50,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; ...@@ -39,23 +50,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF';
SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1; SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 3
auto_increment_offset 1
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
4 dummy_text 4 dummy_text
7 dummy_text 7 dummy_text
10 dummy_text 10 dummy_text
connection node_2; connection node_2;
select * from t1; show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 2
select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
4 dummy_text 4 dummy_text
...@@ -64,6 +82,7 @@ i c ...@@ -64,6 +82,7 @@ i c
connection node_1; connection node_1;
SET GLOBAL wsrep_auto_increment_control='ON'; SET GLOBAL wsrep_auto_increment_control='ON';
SET SESSION binlog_format='ROW'; SET SESSION binlog_format='ROW';
connection node_1;
show variables like 'binlog_format'; show variables like 'binlog_format';
Variable_name Value Variable_name Value
binlog_format ROW binlog_format ROW
...@@ -79,29 +98,37 @@ auto_increment_increment 3 ...@@ -79,29 +98,37 @@ auto_increment_increment 3
auto_increment_offset 1 auto_increment_offset 1
wsrep_auto_increment_control OFF wsrep_auto_increment_control OFF
SET GLOBAL wsrep_auto_increment_control='ON'; SET GLOBAL wsrep_auto_increment_control='ON';
connection node_1;
drop table t1; drop table t1;
connection node_2; connection node_2;
SET GLOBAL wsrep_forced_binlog_format='ROW'; SET GLOBAL wsrep_forced_binlog_format='ROW';
connection node_1; connection node_1;
SET GLOBAL wsrep_forced_binlog_format='ROW'; SET GLOBAL wsrep_forced_binlog_format='ROW';
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 1
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
3 dummy_text 3 dummy_text
5 dummy_text 5 dummy_text
7 dummy_text 7 dummy_text
connection node_2; connection node_2;
select * from t1; show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 2
select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
3 dummy_text 3 dummy_text
...@@ -119,23 +146,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; ...@@ -119,23 +146,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF';
SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1; SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 3
auto_increment_offset 1
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
4 dummy_text 4 dummy_text
7 dummy_text 7 dummy_text
10 dummy_text 10 dummy_text
connection node_2; connection node_2;
select * from t1; show variables like 'auto_increment%';
Variable_name Value
auto_increment_increment 2
auto_increment_offset 2
select * from t1 order by i;
i c i c
1 dummy_text 1 dummy_text
4 dummy_text 4 dummy_text
...@@ -149,13 +183,13 @@ binlog_format ROW ...@@ -149,13 +183,13 @@ binlog_format ROW
show variables like '%auto_increment%'; show variables like '%auto_increment%';
Variable_name Value Variable_name Value
auto_increment_increment 2 auto_increment_increment 2
auto_increment_offset 1 auto_increment_offset 2
wsrep_auto_increment_control ON wsrep_auto_increment_control ON
SET GLOBAL wsrep_auto_increment_control='OFF'; SET GLOBAL wsrep_auto_increment_control='OFF';
show variables like '%auto_increment%'; show variables like '%auto_increment%';
Variable_name Value Variable_name Value
auto_increment_increment 3 auto_increment_increment 1
auto_increment_offset 1 auto_increment_offset 2
wsrep_auto_increment_control OFF wsrep_auto_increment_control OFF
SET GLOBAL wsrep_auto_increment_control='ON'; SET GLOBAL wsrep_auto_increment_control='ON';
drop table t1; drop table t1;
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
[mysqld.1] [mysqld.1]
auto_increment_offset=1 auto_increment_offset=1
auto_increment_increment=1
[mysqld.2] [mysqld.2]
auto_increment_offset=2 auto_increment_offset=2
auto_increment_increment=1
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
## ##
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/force_restart.inc
--connection node_1
SET GLOBAL auto_increment_offset=1;
--connection node_2
SET GLOBAL auto_increment_offset=2;
--let $node_1=node_1 --let $node_1=node_1
--let $node_2=node_2 --let $node_2=node_2
...@@ -22,23 +27,24 @@ SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; ...@@ -22,23 +27,24 @@ SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
select * from t1; show variables like 'auto_increment%';
select * from t1 order by i;
SET GLOBAL wsrep_forced_binlog_format='none'; SET GLOBAL wsrep_forced_binlog_format='none';
...@@ -72,36 +78,31 @@ SET SESSION auto_increment_increment = 3; ...@@ -72,36 +78,31 @@ SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1; SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
show variables like 'auto_increment%';
select * from t1; select * from t1 order by i;
--connection node_1 --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 GLOBAL wsrep_auto_increment_control='ON';
SET SESSION binlog_format='ROW'; SET SESSION binlog_format='ROW';
--source include/auto_increment_offset_restore.inc
--connection node_1
show variables like 'binlog_format'; show variables like 'binlog_format';
show variables like '%auto_increment%'; show variables like '%auto_increment%';
...@@ -119,7 +120,8 @@ show variables like '%auto_increment%'; ...@@ -119,7 +120,8 @@ show variables like '%auto_increment%';
## ##
SET GLOBAL wsrep_auto_increment_control='ON'; SET GLOBAL wsrep_auto_increment_control='ON';
--source include/auto_increment_offset_restore.inc
--connection node_1
drop table t1; drop table t1;
## ##
...@@ -134,24 +136,25 @@ SET GLOBAL wsrep_forced_binlog_format='ROW'; ...@@ -134,24 +136,25 @@ SET GLOBAL wsrep_forced_binlog_format='ROW';
SET GLOBAL wsrep_forced_binlog_format='ROW'; SET GLOBAL wsrep_forced_binlog_format='ROW';
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
select * from t1; show variables like 'auto_increment%';
select * from t1 order by i;
SET GLOBAL wsrep_forced_binlog_format='none'; SET GLOBAL wsrep_forced_binlog_format='none';
...@@ -181,24 +184,25 @@ SET SESSION auto_increment_increment = 3; ...@@ -181,24 +184,25 @@ SET SESSION auto_increment_increment = 3;
SET SESSION auto_increment_offset = 1; SET SESSION auto_increment_offset = 1;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL AUTO_INCREMENT, i int(11) NOT NULL primary key AUTO_INCREMENT,
c char(32) DEFAULT 'dummy_text', c char(32) DEFAULT 'dummy_text'
PRIMARY KEY (i)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show variables like 'auto_increment%';
insert into t1(i) values(null); insert into t1(i) values(null);
select * from t1; select * from t1 order by i;
insert into t1(i) values(null), (null), (null); insert into t1(i) values(null), (null), (null);
select * from t1; select * from t1 order by i;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
show variables like 'auto_increment%';
select * from t1; select * from t1 order by i;
--connection node_1 --connection node_1
...@@ -208,6 +212,7 @@ select * from t1; ...@@ -208,6 +212,7 @@ select * from t1;
## ##
SET GLOBAL wsrep_auto_increment_control='ON'; SET GLOBAL wsrep_auto_increment_control='ON';
--source include/auto_increment_offset_restore.inc
show variables like 'binlog_format'; show variables like 'binlog_format';
show variables like '%auto_increment%'; show variables like '%auto_increment%';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment