Skip to content

Commit

Permalink
MDEV-33850 : For Galera, create sequence with low cache got signal 6 …
Browse files Browse the repository at this point in the history
…error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED

Problem was that transacton was BF-aborted after certification
succeeded and transaction tried to rollback and during
rollback binlog stmt cache containing sequence value reservations
was written into binlog.

Transaction must replay because certification succeeded but
transaction must not be written into binlog yet, it will
be done during commit after the replay.

Fix is to skip binlog write if transaction must replay and
in replay we need to reset binlog stmt cache.
  • Loading branch information
janlindstrom committed Feb 11, 2025
1 parent 64b964e commit 09385e9
Show file tree
Hide file tree
Showing 10 changed files with 809 additions and 1 deletion.
1 change: 0 additions & 1 deletion mysql-test/suite/galera/disabled.def
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
#
##############################################################################

galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/r/galera_sequences.result
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ select NEXT VALUE FOR Seq1_1;
NEXT VALUE FOR Seq1_1
4
connection node_1;
SHOW CREATE SEQUENCE Seq1_1;
Table Create Table
Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
DROP SEQUENCE Seq1_1;
connection node_1;
CREATE TABLE t2 (d CHAR(1)KEY);
Expand Down
79 changes: 79 additions & 0 deletions mysql-test/suite/galera/r/galera_sequences_bf_kill.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
connection node_2;
connection node_1;
connection node_1;
CREATE SEQUENCE s INCREMENT=0 CACHE=10 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0), (3, 0);
connection node_1;
START TRANSACTION;
INSERT INTO t1 VALUES (4, next value for s);
INSERT INTO t1 VALUES (5, next value for s);
INSERT INTO t1 VALUES (6, next value for s);
INSERT INTO t1 VALUES (7, next value for s);
INSERT INTO t1 VALUES (8, next value for s);
INSERT INTO t1 VALUES (9, next value for s);
INSERT INTO t1 VALUES (10, next value for s);
INSERT INTO t1 VALUES (11, next value for s);
INSERT INTO t1 VALUES (12, next value for s);
INSERT INTO t1 VALUES (13, next value for s);
INSERT INTO t1 VALUES (14, next value for s);
SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE;
f1 f2
1 0
3 0
4 1
5 3
6 5
7 7
8 9
9 11
10 13
11 15
12 17
13 19
14 21
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
INSERT INTO t1 VALUES (2, 2);
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
connection node_1;
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_1;
wsrep_local_replays
1
connection node_1;
SELECT * FROM t1;
f1 f2
1 0
2 2
3 0
4 1
5 3
6 5
7 7
8 9
9 11
10 13
11 15
12 17
13 19
14 21
DROP SEQUENCE s;
DROP TABLE t1;
Loading

0 comments on commit 09385e9

Please sign in to comment.