mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-10518: Large wsrep_gtid_domain_id may break IST
wsrep_gtid_domain_id was incorrectly being parsed and stored as a signed long number on the joiner node.
This commit is contained in:
parent
3ac0721a3c
commit
2024cddaa4
4 changed files with 147 additions and 3 deletions
74
mysql-test/suite/galera/r/mdev_10518.result
Normal file
74
mysql-test/suite/galera/r/mdev_10518.result
Normal file
|
@ -0,0 +1,74 @@
|
|||
# On node_1
|
||||
list of GTID variables :
|
||||
gtid_domain_id 1
|
||||
gtid_binlog_pos
|
||||
gtid_binlog_state
|
||||
gtid_current_pos
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_2
|
||||
list of GTID variables :
|
||||
gtid_domain_id 2
|
||||
gtid_binlog_pos
|
||||
gtid_binlog_state
|
||||
gtid_current_pos
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_1
|
||||
CREATE TABLE t1(i INT) ENGINE=INNODB;
|
||||
CREATE TABLE t2(i INT) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
SELECT * FROM t2;
|
||||
i
|
||||
list of GTID variables :
|
||||
gtid_domain_id 1
|
||||
gtid_binlog_pos 4294967295-1-3
|
||||
gtid_binlog_state 4294967295-1-3
|
||||
gtid_current_pos 4294967295-1-3
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_2
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
list of GTID variables :
|
||||
gtid_domain_id 2
|
||||
gtid_binlog_pos 4294967295-1-3
|
||||
gtid_binlog_state 4294967295-1-3
|
||||
gtid_current_pos
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_1
|
||||
INSERT INTO t2 VALUES(1);
|
||||
SELECT * FROM t2;
|
||||
i
|
||||
1
|
||||
list of GTID variables :
|
||||
gtid_domain_id 1
|
||||
gtid_binlog_pos 1-1-1,4294967295-1-3
|
||||
gtid_binlog_state 1-1-1,4294967295-1-3
|
||||
gtid_current_pos 1-1-1,4294967295-1-3
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_2
|
||||
SELECT * FROM t2;
|
||||
i
|
||||
list of GTID variables :
|
||||
gtid_domain_id 2
|
||||
gtid_binlog_pos 4294967295-1-3
|
||||
gtid_binlog_state 4294967295-1-3
|
||||
gtid_current_pos
|
||||
gtid_slave_pos
|
||||
wsrep_gtid_domain_id 4294967295
|
||||
wsrep_gtid_mode 1
|
||||
# On node_1
|
||||
DROP TABLE t1, t2;
|
||||
# End of test
|
17
mysql-test/suite/galera/t/mdev_10518.cnf
Normal file
17
mysql-test/suite/galera/t/mdev_10518.cnf
Normal file
|
@ -0,0 +1,17 @@
|
|||
!include ../galera_2nodes.cnf
|
||||
|
||||
[mysqld]
|
||||
log-bin
|
||||
log-slave-updates
|
||||
|
||||
[mysqld.1]
|
||||
gtid_domain_id=1
|
||||
wsrep_gtid_mode=ON
|
||||
# Maximum allowed wsrep_gtid_domain_id.
|
||||
wsrep_gtid_domain_id=4294967295
|
||||
|
||||
[mysqld.2]
|
||||
gtid_domain_id=2
|
||||
wsrep_gtid_mode=ON
|
||||
#wsrep_gitd_domain_id value will be inherited from donor node (mysqld.1)
|
||||
#wsrep_gitd_domain_id=X
|
53
mysql-test/suite/galera/t/mdev_10518.test
Normal file
53
mysql-test/suite/galera/t/mdev_10518.test
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Test for @@wsrep_gtid_mode and @@wsrep_gtid_domain_id variables
|
||||
#
|
||||
# When @@wsrep_gtid_mode=ON, all DDL/DML commands and transactions that
|
||||
# are meant to be replicated over Galera cluster nodes are tagged with
|
||||
# galera gtid_domain_id (@@wsrep_gtid_domain_id), while others are tagged
|
||||
# with the local domain_id (@@gtid_domain_id).
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--echo # On node_1
|
||||
--connection node_1
|
||||
# print initial GTIDs
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_2
|
||||
--connection node_2
|
||||
# print initial GTIDs
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_1
|
||||
--connection node_1
|
||||
CREATE TABLE t1(i INT) ENGINE=INNODB;
|
||||
CREATE TABLE t2(i INT) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_2
|
||||
--connection node_2
|
||||
SELECT * FROM t1;
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_1
|
||||
--connection node_1
|
||||
INSERT INTO t2 VALUES(1);
|
||||
SELECT * FROM t2;
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_2
|
||||
--connection node_2
|
||||
SELECT * FROM t2;
|
||||
source include/print_gtid.inc;
|
||||
|
||||
--echo # On node_1
|
||||
--connection node_1
|
||||
# Cleanup
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--source include/galera_end.inc
|
||||
--echo # End of test
|
||||
|
|
@ -477,7 +477,7 @@ static void* sst_joiner_thread (void* a)
|
|||
} else {
|
||||
// Scan state ID first followed by wsrep_gtid_domain_id.
|
||||
char uuid[512];
|
||||
long int domain_id;
|
||||
unsigned long int domain_id;
|
||||
size_t len= pos - out + 1;
|
||||
|
||||
if (len > sizeof(uuid)) goto err; // safety check
|
||||
|
@ -491,11 +491,11 @@ static void* sst_joiner_thread (void* a)
|
|||
else if (wsrep_gtid_mode)
|
||||
{
|
||||
errno= 0; /* Reset the errno */
|
||||
domain_id= strtol(pos + 1, NULL, 10);
|
||||
domain_id= strtoul(pos + 1, NULL, 10);
|
||||
err= errno;
|
||||
|
||||
/* Check if we received a valid gtid_domain_id. */
|
||||
if (err == EINVAL || err == ERANGE || domain_id < 0x0 || domain_id > 0xFFFF)
|
||||
if (err == EINVAL || err == ERANGE)
|
||||
{
|
||||
WSREP_ERROR("Failed to get donor wsrep_gtid_domain_id.");
|
||||
err= EINVAL;
|
||||
|
|
Loading…
Reference in a new issue