1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT

A simple "SET SESSION gtid_seq_no= DEFAULT" did not work, it would straight
up crash the server! Also, explicitly setting gtid_seq_no to 0 gave an error
in --gtid-strict-mode=1.

Setting to DEFAULT or 0 should disable any prior setting of
gtid_seq_no, so that the next transaction is allocated the next GTID
in sequence, as normal.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2023-07-17 15:06:50 +02:00
parent 9854fb6fa7
commit d632c85bb7
6 changed files with 176 additions and 7 deletions

View File

@@ -565,6 +565,50 @@ SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
--echo *** MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT
--connection server_1
# Setting gtid_seq_no forces the GTID logged, but only once.
SET SESSION gtid_seq_no= 2000;
SELECT @@SESSION.gtid_seq_no;
INSERT INTO t1 VALUES (40);
SELECT @@SESSION.gtid_seq_no;
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
INSERT INTO t1 VALUES (41);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting to 0 has no effect.
SET SESSION gtid_seq_no= 2010;
INSERT INTO t1 VALUES (42);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET @old_strict= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (43);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET GLOBAL gtid_strict_mode= @old_strict;
INSERT INTO t1 VALUES (44);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting gtid_seq_no multiple times.
SET SESSION gtid_seq_no= 2020;
SET SESSION gtid_seq_no= 2030;
INSERT INTO t1 VALUES (45);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting to DEFAULT or 0 disables prior setting.
SET SESSION gtid_seq_no= 2040;
SET SESSION gtid_seq_no= DEFAULT;
INSERT INTO t1 VALUES (46);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
INSERT INTO t1 VALUES (47);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET SESSION gtid_seq_no= 2050;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (48);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Clean up.
--connection server_1
DROP TABLE t1;