summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2020-06-25 13:25:15 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2020-06-25 13:25:15 +0200
commitcc4fc262676889bcab4fbae7fdb75ff69b8a6a49 (patch)
tree845b1e017e3feef61e34c0e87f9eb6c055a2512f
parent65b93cef3820115286ecd143202c29f931be85c0 (diff)
parent198a4fee3cdd800b24845acdb9cf986e13a9e757 (diff)
downloadmariadb-git-bb-10.5-MDEV-22729.tar.gz
Merge branch '10.5-MDEV-22729' into bb-10.5-MDEV-22729bb-10.5-MDEV-22729
-rw-r--r--mysql-test/suite/galera/r/galera_slave_replay.result14
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.cnf1
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.test34
-rw-r--r--sql/service_wsrep.cc3
4 files changed, 21 insertions, 31 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.cnf b/mysql-test/suite/galera/t/galera_slave_replay.cnf
new file mode 100644
index 00000000000..9449ec9cf40
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_slave_replay.cnf
@@ -0,0 +1 @@
+!include ../galera_2nodes_as_slave.cnf
diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test
index 37c4cbd5b43..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
@@ -21,9 +22,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
#
@@ -33,10 +32,10 @@ SET GLOBAL wsrep_on=ON;
#
-# 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;
@@ -156,35 +155,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 +188,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;
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
index 4137454e19b..6b06bddd773 100644
--- a/sql/service_wsrep.cc
+++ b/sql/service_wsrep.cc
@@ -313,7 +313,8 @@ extern "C" void wsrep_commit_ordered(THD *thd)
{
thd->wsrep_last_written_gtid_seqno= thd->wsrep_current_gtid_seqno;
}
- if (!wsrep_commit_will_write_binlog(thd))
+ if (thd->wsrep_trx().state() != wsrep::transaction::s_ordered_commit &&
+ !wsrep_commit_will_write_binlog(thd))
{
DEBUG_SYNC(thd, "before_wsrep_ordered_commit");
thd->wsrep_cs().ordered_commit();