mirror of
https://github.com/MariaDB/server.git
synced 2025-02-12 00:15:35 +01:00
![Jan Lindström](/assets/img/avatar_default.png)
Problem was caused by MDEV-31413 commit 277968aa
where
mysql.gtid_slave_pos table was replicated by Galera.
However, as not all nodes in Galera cluster are replica
nodes, rows were not deleted from table.
In this fix this is corrected so that mysql.gtid_slave_pos
table is not replicated by Galera. Instead when Galera
node receives GTID event and wsrep_gtid_mode=1, this event
is stored to mysql.gtid_slave_pos table.
Added test case galera_2primary_replica for 2 async
primaries replicating to galera cluster.
Added test case galera_circular_replication where
async primary replicates to galera cluster and
one of the galera cluster nodes is master
to async replica.
Modified test case galera_restart_replica to monitor
gtid positions and rows in mysql.gtid_pos_table.
95 lines
2.7 KiB
Text
95 lines
2.7 KiB
Text
connection node_2;
|
|
connection node_1;
|
|
connect primary1, 127.0.0.1, root, , test, $NODE_MYPORT_3;
|
|
connect primary2, 127.0.0.1, root, , test, $NODE_MYPORT_4;
|
|
connection primary1;
|
|
# Primary1 creating user for replication
|
|
create user repl@'%' identified by 'repl';
|
|
grant all on *.* to repl@'%';
|
|
connection primary2;
|
|
# Primary2 creating user for replication
|
|
create user repl2@'%' identified by 'repl2';
|
|
grant all on *.* to repl2@'%';
|
|
connect replica, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
|
connection replica;
|
|
connection node_2;
|
|
connection replica;
|
|
# Galera replica changing master to primary1
|
|
SET @@default_master_connection='stream2';
|
|
# Primary node changing master to primary2
|
|
START ALL SLAVES;
|
|
Warnings:
|
|
Note 1937 SLAVE 'stream1' started
|
|
Note 1937 SLAVE 'stream2' started
|
|
connection primary1;
|
|
# Primary 1: Creating table and populating it with data
|
|
CREATE TABLE t1 (id bigint auto_increment primary key, msg varchar(100)) engine=innodb;
|
|
# Intentionally generate 1k GTID-events
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
|
|
EXPECT_1000
|
|
1000
|
|
connection primary2;
|
|
# Primary 2: Creating table and populating it with data
|
|
CREATE TABLE t2 (id bigint auto_increment primary key, msg varchar(100)) engine=innodb;
|
|
# Intentionally generate 1k GTID-events
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t2;
|
|
EXPECT_1000
|
|
1000
|
|
connection replica;
|
|
# Waiting for data to replicate to node_1
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
|
|
EXPECT_1000
|
|
1000
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t2;
|
|
EXPECT_1000
|
|
1000
|
|
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
|
|
EXPECT_1
|
|
1
|
|
SELECT COUNT(*) < 1000 AS EXPECT_1 FROM mysql.gtid_slave_pos;
|
|
EXPECT_1
|
|
1
|
|
SELECT @@gtid_slave_pos,@@gtid_binlog_pos,@@gtid_current_pos;
|
|
@@gtid_slave_pos @@gtid_binlog_pos @@gtid_current_pos
|
|
3-3-1003,4-4-1003 3-3-1003,4-4-1003 3-3-1003,4-4-1003
|
|
connection node_2;
|
|
# Waiting for data to replicate to node_2
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t1;
|
|
EXPECT_1000
|
|
1000
|
|
SELECT COUNT(*) AS EXPECT_1000 FROM t2;
|
|
EXPECT_1000
|
|
1000
|
|
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
|
|
EXPECT_1
|
|
1
|
|
SELECT COUNT(*) < 1000 AS EXPECT_1 FROM mysql.gtid_slave_pos;
|
|
EXPECT_1
|
|
1
|
|
SELECT @@gtid_slave_pos,@@gtid_binlog_pos,@@gtid_current_pos;
|
|
@@gtid_slave_pos @@gtid_binlog_pos @@gtid_current_pos
|
|
3-3-1003,4-4-1003 3-3-1003,4-4-1003 3-3-1003,4-4-1003
|
|
connection primary1;
|
|
drop table t1;
|
|
connection primary2;
|
|
drop table t2;
|
|
# Wait until drop table is replicated on Galera
|
|
connection replica;
|
|
connection node_2;
|
|
connection replica;
|
|
STOP ALL SLAVES;
|
|
Warnings:
|
|
Note 1938 SLAVE 'stream1' stopped
|
|
Note 1938 SLAVE 'stream2' stopped
|
|
RESET SLAVE ALL;
|
|
connection primary1;
|
|
RESET MASTER;
|
|
connection primary2;
|
|
RESET MASTER;
|
|
connection node_1;
|
|
disconnect primary1;
|
|
disconnect primary2;
|
|
disconnect replica;
|
|
disconnect node_2;
|
|
disconnect node_1;
|
|
# End of test
|