Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mysql-test/suite/galera/r/galera_sequences.result
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ t CREATE TABLE `t` (
) ENGINE=InnoDB SEQUENCE=1
connection node_1;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
CREATE SEQUENCE t INCREMENT BY 0 CACHE 1 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
connection node_2;
# Wait DDL to replicate
Expand Down
132 changes: 132 additions & 0 deletions mysql-test/suite/galera/r/galera_sequences_recovery.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
connection node_2;
connection node_1;
connection node_1;
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
connection node_1;
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
connection node_2;
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
Killing server ...
SELECT NEXTVAL(s);
NEXTVAL(s)
12
connection node_1;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
LASTVAL(s)
29
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
21 1
23 1
25 1
27 1
29 1
connection node_2;
SELECT LASTVAL(s);
LASTVAL(s)
12
SELECT NEXTVAL(s);
NEXTVAL(s)
32
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
21 1
23 1
25 1
27 1
29 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
connection node_1;
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
connection node_1;
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
connection node_2;
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
Killing server ...
connection node_1;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
LASTVAL(s)
19
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
11 1
13 1
15 1
17 1
19 1
connection node_2;
SELECT NEXTVAL(s);
NEXTVAL(s)
22
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
11 1
13 1
15 1
17 1
19 1
connection node_1;
SELECT LASTVAL(s);
LASTVAL(s)
19
SELECT NEXTVAL(s);
NEXTVAL(s)
33
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
28 changes: 23 additions & 5 deletions mysql-test/suite/galera/r/galera_sequences_transaction.result
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ LASTVAL(s)
connection node_1a;
SELECT LASTVAL(s);
LASTVAL(s)
79
81
connection node_1;
SELECT * FROM t1;
f1 f2
Expand Down Expand Up @@ -106,7 +106,6 @@ f1 f2
56 1
58 1
60 1
61 1
63 1
65 1
67 1
Expand All @@ -116,6 +115,7 @@ f1 f2
75 1
77 1
79 1
81 1
connection node_2;
SELECT * FROM t1;
f1 f2
Expand Down Expand Up @@ -149,7 +149,6 @@ f1 f2
56 1
58 1
60 1
61 1
63 1
65 1
67 1
Expand All @@ -159,6 +158,7 @@ f1 f2
75 1
77 1
79 1
81 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
Expand Down Expand Up @@ -299,10 +299,8 @@ connection node_1a;
ROLLBACK;
connection node_2;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2a;
ROLLBACK;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
SELECT LASTVAL(s);
LASTVAL(s)
Expand Down Expand Up @@ -332,6 +330,16 @@ f1 f2
15 1
17 1
19 1
22 1
24 1
26 1
28 1
30 1
32 1
34 1
36 1
38 1
40 1
connection node_2;
SELECT * FROM t1;
f1 f2
Expand All @@ -345,6 +353,16 @@ f1 f2
15 1
17 1
19 1
22 1
24 1
26 1
28 1
30 1
32 1
34 1
36 1
38 1
40 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
2 changes: 1 addition & 1 deletion mysql-test/suite/galera/r/mdev-22063.result
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SELECT * FROM t1;
a
SELECT * FROM s;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
1 1 9223372036854775806 1 1 0 0 0
connection node_1;
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
DROP TABLE t1;
Expand Down
11 changes: 2 additions & 9 deletions mysql-test/suite/galera/t/galera_sequences.test
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ SHOW CREATE TABLE t;

--connection node_1
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
# Don't use NOCACHE as it may produce duplicate entries from multiple nodes
CREATE SEQUENCE t INCREMENT BY 0 CACHE 1 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;

--connection node_2
Expand Down Expand Up @@ -193,15 +194,11 @@ SET SESSION wsrep_sync_wait=0;
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (2);
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (2);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1);
--dec $count
}
Expand Down Expand Up @@ -251,15 +248,11 @@ SET SESSION wsrep_sync_wait=0;
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--dec $count
}
Expand Down
9 changes: 9 additions & 0 deletions mysql-test/suite/galera/t/galera_sequences_recovery.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!include ../galera_2nodes.cnf

[mysqld.1]
auto-increment-increment=2
auto-increment-offset=1

[mysqld.2]
auto-increment-increment=2
auto-increment-offset=2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[binlogon]
log-bin
log-slave-updates

[binlogoff]
Loading