Commit 44c4b230 authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-8496: gtid_ignore_duplicates treats gtid_seq_no as 32-bit

--gtid-ignore-duplicates was comparing sequence numbers as 32-bit, so
after 2**32 transactions things would start to fail.
parent b89de2b2
......@@ -381,6 +381,39 @@ a
50
SET GLOBAL slave_exec_mode=@old_slave_mode;
SET GLOBAL gtid_strict_mode=@old_strict;
*** MDEV-8496: gtid_ignore_duplicates treats gtid_seq_no as 32-bit ***
SET @old_domain= @@SESSION.gtid_domain_id;
SET SESSION gtid_domain_id=102;
SET SESSION gtid_seq_no=4294967294;
INSERT INTO t1 VALUES (60);
INSERT INTO t1 VALUES (61);
INSERT INTO t1 VALUES (62);
SET SESSION gtid_domain_id= @old_domain;
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
a
60
61
62
SET default_master_connection = "c2b";
include/sync_with_master_gtid.inc
SET default_master_connection = "a2b";
include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
a
60
61
62
SET default_master_connection = "b2c";
include/sync_with_master_gtid.inc
SET default_master_connection = "a2c";
include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
a
60
61
62
SET GLOBAL gtid_domain_id=0;
STOP ALL SLAVES;
Warnings:
......
......@@ -366,6 +366,40 @@ SET GLOBAL slave_exec_mode=@old_slave_mode;
SET GLOBAL gtid_strict_mode=@old_strict;
--echo *** MDEV-8496: gtid_ignore_duplicates treats gtid_seq_no as 32-bit ***
--connection server_1
SET @old_domain= @@SESSION.gtid_domain_id;
SET SESSION gtid_domain_id=102;
SET SESSION gtid_seq_no=4294967294;
INSERT INTO t1 VALUES (60);
INSERT INTO t1 VALUES (61);
INSERT INTO t1 VALUES (62);
# The bug was an overflow, the seq_no value 4294967296 (2**32) was treated
# as 0, causing the last transaction to be ignored.
SET SESSION gtid_domain_id= @old_domain;
--source include/save_master_gtid.inc
--connection server_4
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
--connection server_2
SET default_master_connection = "c2b";
--source include/sync_with_master_gtid.inc
SET default_master_connection = "a2b";
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
--connection server_3
SET default_master_connection = "b2c";
--source include/sync_with_master_gtid.inc
SET default_master_connection = "a2c";
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 WHERE a >= 60 ORDER BY a;
# Clean up.
--connection server_1
SET GLOBAL gtid_domain_id=0;
......
......@@ -117,7 +117,7 @@ int
rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
{
uint32 domain_id= gtid->domain_id;
uint32 seq_no= gtid->seq_no;
uint64 seq_no= gtid->seq_no;
rpl_slave_state::element *elem;
int res;
bool did_enter_cond= false;
......
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