1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

BUG#13874553: rpl.rpl_stop_slave fails sporadically on pb2

The test case makes use of the fine DEBUG_SYNC facility. Furthermore,
since it needs synchronization on internal threads (dump and SQL
threads) the server code has DEBUG_SYNC commands internally deployed
and activated through the DBUG_EXECUTE_IF macro. The internal
DBUG_SYNC commands are then controlled from the test case through the
DEBUG variable.

There were three problems around the DEBUG + DEBUG_SYNC facility
usage:

1. When signaling the SQL thread to continue, the test would reset
   immediately the DEBUG_SYNC variable. This could mean that the SQL
   thread might loose the signal and continue to wait forever;

2. A similar scenario was happening with the dump thread on the
   master. This thread was instructed to wait, and later it would be
   signaled to continue, but immediately after the DEBUG_SYNC would be
   reset. This could lead to the dump thread missing the signal and
   wait forever;

3. The test was not cleaning itself up with respect to the
   instrumentation of the dump thread. This would leave the
   conditional execution of an internal DEBUG_SYNC command active
   (through the usage of DBUG_EXECUTE_IF). 

We fix #1 and #2 by waiting for the threads to receive the signal and
only then issue the reset. We fix #3 by reseting the DEBUG variable,
thus deactivating the dump thread internal DEBUG_SYNC command.
This commit is contained in:
Luis Soares
2014-06-26 12:54:27 +01:00
parent c6c2d43a60
commit 5111df0814
3 changed files with 38 additions and 4 deletions

View File

@@ -93,10 +93,12 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
include/stop_slave.inc
[connection master]
include/stop_dump_threads.inc
SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
[connection slave]
include/restart_slave.inc
include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
[connection master]
@@ -115,8 +117,11 @@ SET DEBUG_SYNC= 'RESET';
[connection slave]
include/wait_for_slave_to_stop.inc
[connection slave1]
[connection master]
SET GLOBAL debug= '$debug_save';
include/stop_dump_threads.inc
[connection slave1]
include/start_slave.inc
[connection master]
DROP TABLE t1, t2;
SET GLOBAL debug= $debug_save;
include/rpl_end.inc