From a4838721a252ea5570b5fed9ab56e38e5b234865 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Wed, 27 Mar 2024 13:39:59 +0300 Subject: [PATCH] MDEV-32633: Fix Galera cluster <-> native replication interaction GTID events are applied without a running server transaction, we need to set next transaction ID for Wsrep transaction. The whole Galera cluster now has a single GTID value (including the server ID throughout the cluster), fix the config accordingly. Add force restart so that repeated MTR test execution prints consistent GTID values, otherwise they would have been recovered from the previous run. Signed-off-by: Julius Goryavsky --- .../r/galera_gtid_2_cluster.result | 98 +++++++++++++++++++ .../galera_3nodes/t/galera_gtid_2_cluster.cnf | 8 +- .../t/galera_gtid_2_cluster.test | 27 +++++ 3 files changed, 129 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result index ee622ba23c8..1cb14cd3eff 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -166,6 +166,55 @@ cluster_domain_id node_server_id seq_no 2 21 1 2 22 2 2 23 3 +# check other nodes are consistent +connection node_2; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_3; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_5; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_6; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-4,2-21-3 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 cluster 1 node 1 connection node_1; select @@gtid_binlog_state; @@ -337,6 +386,55 @@ cluster_domain_id node_server_id seq_no 2 21 1 2 22 2 2 23 3 +# check other nodes are consistent +connection node_2; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_3; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_5; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 +connection node_6; +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-9,2-21-6 +select * from t1 order by 1, 2, 3; +cluster_domain_id node_server_id seq_no +1 11 2 +1 12 3 +1 13 4 +2 21 1 +2 22 2 +2 23 3 cluster 1 node 1 connection node_1; select @@gtid_binlog_state; diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf index dc5535ef34a..bc64d114275 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -9,11 +9,11 @@ server-id=11 [mysqld.2] wsrep_gtid_domain_id=1 -server-id=12 +server-id=11 [mysqld.3] wsrep_gtid_domain_id=1 -server-id=13 +server-id=11 [mysqld.4] wsrep_gtid_domain_id=2 @@ -21,8 +21,8 @@ server-id=21 [mysqld.5] wsrep_gtid_domain_id=2 -server-id=22 +server-id=21 [mysqld.6] wsrep_gtid_domain_id=2 -server-id=23 +server-id=21 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test index efbfad36e35..c8247f15aba 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -11,6 +11,7 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc --connection node_1 --echo cluster 1 node 1 @@ -135,6 +136,19 @@ select @@gtid_binlog_state; --source include/sync_with_master_gtid.inc select * from t1 order by 1, 2, 3; +--echo # check other nodes are consistent +--connection node_2 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_3 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_5 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_6 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; --echo cluster 1 node 1 --connection node_1 @@ -291,6 +305,19 @@ select @@gtid_binlog_state; --source include/sync_with_master_gtid.inc select * from t1 order by 1, 2, 3; +--echo # check other nodes are consistent +--connection node_2 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_3 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_5 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; +--connection node_6 +select @@gtid_binlog_state; +select * from t1 order by 1, 2, 3; --echo cluster 1 node 1 --connection node_1