From ccec6b887b073dd509f5645aad7ab38ce5f972ac Mon Sep 17 00:00:00 2001 From: sjaakola Date: Wed, 27 May 2020 21:21:24 +0300 Subject: [PATCH 1/2] MDEV-22729 fixes for galera.galera_slave_replay test The test was changing wsrep_on option in node_3, which is native MariaDB server (i.e. not a cluster node). Native NariaDB server should not manipulate wsrep replication state, this problem is fixed. galera.galera_slave_replay test phase 2 will cause certification failure for async slave SQL handler thread. This certification failure is now monitored and required to happen in the test. The test phase 2, generates scenario, where async slave SQL handler faces certification failure and galera slave applier is paused when this happens. This makes the test vulnerable for anomaly described in MDEV-22632. Therefore the fix in this commit depends on MDEV-22632, and should be merged after the fix for MDEV-22632. --- .../suite/galera/r/galera_slave_replay.result | 14 +++------ .../suite/galera/t/galera_slave_replay.test | 29 +++++++------------ 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result index e8dd6ae87b1..0b0199c4a02 100644 --- a/mysql-test/suite/galera/r/galera_slave_replay.result +++ b/mysql-test/suite/galera/r/galera_slave_replay.result @@ -4,9 +4,7 @@ connection node_2; connection node_1; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; -SET GLOBAL wsrep_on=OFF; RESET MASTER; -SET GLOBAL wsrep_on=ON; connection node_2a; START SLAVE; connection node_3; @@ -72,20 +70,17 @@ SET AUTOCOMMIT=ON; START TRANSACTION; UPDATE t1 SET f2 = 'd' WHERE f1 = 3; connection node_2a; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; -connection node_3; +connection node_1; UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3; +connection node_2a; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_3; COMMIT; connection node_2a; SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; connection node_2a; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -SET DEBUG_SYNC = "RESET"; -connection node_2a; set session wsrep_sync_wait=15; SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e'; COUNT(*) = 1 @@ -93,9 +88,8 @@ COUNT(*) = 1 set session wsrep_sync_wait=0; STOP SLAVE; RESET SLAVE; +SET DEBUG_SYNC = "RESET"; DROP TABLE t1; connection node_3; DROP TABLE t1; -SET GLOBAL wsrep_on=OFF; RESET MASTER; -SET GLOBAL wsrep_on=ON; diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test index 37c4cbd5b43..bac394baf64 100644 --- a/mysql-test/suite/galera/t/galera_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_slave_replay.test @@ -21,9 +21,7 @@ # --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 -SET GLOBAL wsrep_on=OFF; RESET MASTER; -SET GLOBAL wsrep_on=ON; --connection node_2a # @@ -156,35 +154,31 @@ UPDATE t1 SET f2 = 'd' WHERE f1 = 3; --let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1; --source include/wait_condition.inc -# Block the commit ---let $galera_sync_point = commit_monitor_master_enter_sync ---source include/galera_set_sync_point.inc - # block applier SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; -# Inject a conflicting update from node 3 ---connection node_3 +# Inject a conflicting update from node 1 +--connection node_1 UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3; +--connection node_2a +# wait until applier has reached the sync point +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +--let $expected_cert_failures = `SELECT VARIABLE_VALUE+1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + # send the update from master --connection node_3 --error 0 COMMIT; --connection node_2a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc -# release the applier +# release the applier from node 1 SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; - -# Unblock the async slave commit ---connection node_2a ---source include/galera_clear_sync_point.inc ---source include/galera_signal_sync_point.inc -SET DEBUG_SYNC = "RESET"; - --connection node_2a set session wsrep_sync_wait=15; @@ -193,11 +187,10 @@ set session wsrep_sync_wait=0; STOP SLAVE; RESET SLAVE; +SET DEBUG_SYNC = "RESET"; DROP TABLE t1; --connection node_3 DROP TABLE t1; -SET GLOBAL wsrep_on=OFF; RESET MASTER; -SET GLOBAL wsrep_on=ON; From 7bd11fb46fad3d7db6acbc11ad86aed3c83381c6 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 23 Jun 2020 12:56:08 +0200 Subject: [PATCH 2/2] MDEV-22729: additional changes after merge --- mysql-test/suite/galera/t/galera_slave_replay.test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test index bac394baf64..f1500eeaeaa 100644 --- a/mysql-test/suite/galera/t/galera_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_slave_replay.test @@ -7,6 +7,7 @@ # --source include/have_innodb.inc +--source include/have_log_bin.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc @@ -31,10 +32,10 @@ RESET MASTER; # -# nodes 1 and 2 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 3 +# nodes 1 and 2 form a galera cluster, node 2 operates as slave for native MariaDB master in node 3 # --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; --enable_query_log START SLAVE;