Commit 77f5b188 authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Jan Lindström

MW-357 Reset thd->wsrep_apply_toi regardless of applier exiting

Applier does not reset thd->wsrep_apply_toi if applier thread decides
to exit by setting 'exit= true'. The problem is that galera side may
decide not to kill the applier thread: for instance if we try to
SET wsrep_slave_threads = 0; then galera refuses to kill the last
applier thread. If this happens we are left with a thd which has not
been reset to the initial state.
This patch ensures that the thd is reset regardless of the applier
thread exiting or not.
parent 391b1af0
SET GLOBAL wsrep_slave_threads = 0;
Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_2
SET GLOBAL wsrep_slave_threads = 0;
--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
--connection node_1
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
......@@ -217,6 +217,8 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
{
THD* const thd((THD*)ctx);
assert(thd->wsrep_apply_toi == false);
// Allow tests to block the applier thread using the DBUG facilities.
DBUG_EXECUTE_IF("sync.wsrep_apply_cb",
{
......@@ -380,7 +382,7 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
}
if (*exit == false && thd->wsrep_applier)
if (thd->wsrep_applier)
{
/* From trans_begin() */
thd->variables.option_bits|= OPTION_BEGIN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment