mariadb/mysql-test/suite/galera/t/MW-86-wait1.test
Jan Lindström 5017c261d4 Fix test failure on test MW-86 and remove MW-360 test.
Merged from mysql-wsrep-bugs following:

GCF-1058 MTR test galera.MW-86 fails on repeated runs
Wait for the sync point sync.wsrep_apply_cb to be reached before
executing the test and clearing the debug flag sync.wsrep_apply_cb.

The race scenario:

Intended behavior:
node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT
node1: INSERT start
node2 (background): INSERT start
node1: INSERT end
node2: send signal to background INSERT: "stop waiting and continue executing"
node2: clear sync.wsrep_apply_cb as no longer needed
node2 (background): consume the signal
node2 (background): INSERT end
node2: DROP TABLE
node2: check no pending signals are left - ok

What happens occasionally (unexpected):
node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT
node1: INSERT start
node2 (background): INSERT start
node1: INSERT end
// The background INSERT still has _not_ reached the place where it starts
// waiting for the signal:
// DBUG_EXECUTE_IF("sync.wsrep_apply_cb", "now wait_for...");
node2: send signal to background INSERT: "stop waiting and continue executing"
node2: clear sync.wsrep_apply_cb as no longer needed
// The background INSERT reaches DBUG_EXECUTE_IF("sync.wsrep_apply_cb", ...)
// but sync.wsrep_apply_cb has already been cleared and the "wait" code is not
// executed. The signal remains unconsumed.
node2 (background): INSERT end
node2: DROP TABLE
node2: check no pending signals are left - failure, signal.wsrep_apply_cb is
pending (not consumed)

Remove MW-360 test case as it is not intended for MariaDB (uses
MySQL GTID).
2017-08-15 13:57:15 +03:00

106 lines
2.1 KiB
Text

#
# SHOW commands no longer obey wsrep_sync_wait = 1 (WSREP_SYNC_WAIT_BEFORE_READ)
# (they do not wait for the background INSERT in the applier in node_2 to
# complete)
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--source include/have_debug_sync.inc
--connection node_2
# Make sure no signals have been leftover from previous tests to surprise us.
SELECT @@debug_sync;
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
--connection node_1
CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
# This will complete in node_1 but will start a background apply in node_2
# which will stop because of sync.wsrep_apply_cb we set above.
INSERT INTO t_wait1 VALUES (1);
--connection node_2
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--disable_result_log
SHOW BINARY LOGS;
SHOW BINLOG EVENTS;
--error ER_NO_SUCH_TABLE
SHOW COLUMNS FROM t1;
--error ER_EVENT_DOES_NOT_EXIST
SHOW CREATE EVENT e1;
--error ER_SP_DOES_NOT_EXIST
SHOW CREATE FUNCTION f1;
--error ER_SP_DOES_NOT_EXIST
SHOW CREATE PROCEDURE p1;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE t1;
--error ER_TRG_DOES_NOT_EXIST
SHOW CREATE TRIGGER tr1;
--error ER_NO_SUCH_TABLE
SHOW CREATE VIEW v1;
SHOW DATABASES;
SHOW ENGINE InnoDB STATUS;
--error ER_SP_DOES_NOT_EXIST
SHOW FUNCTION CODE f1;
SHOW FUNCTION STATUS;
SHOW GRANTS FOR 'root'@'localhost';
--error ER_NO_SUCH_TABLE
SHOW INDEX FROM t1;
SHOW OPEN TABLES;
--error ER_SP_DOES_NOT_EXIST
SHOW PROCEDURE CODE p1;
SHOW PROCEDURE STATUS;
SHOW PRIVILEGES;
SHOW STATUS LIKE 'wsrep_cluster_size';
SHOW TABLE STATUS;
SHOW TABLES;
SHOW TRIGGERS;
SHOW GLOBAL VARIABLES LIKE 'foo_bar';
--error 0
SHOW WARNINGS;
--enable_result_log
# Unblock the background INSERT and remove the sync point.
SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
SET SESSION wsrep_sync_wait = default;
# This will wait for the background INSERT to complete before we quit
# from the test.
DROP TABLE t_wait1;
SET GLOBAL debug = NULL;
SET debug_sync='RESET';
# Make sure no pending signals are leftover to surprise subsequent tests.
SELECT @@debug_sync;