Commit 5017c261 authored by Jan Lindström's avatar Jan Lindström

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).
parent b5323054
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
DROP TABLE t1, t2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
DROP TABLE t1, t2;
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
CREATE TEMPORARY TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2);
DROP TABLE t1;
DROP TABLE t1;
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 120 Previous_gtids 1 151
mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<local_uuid>:1'
mysqld-bin.000001 199 Query 1 339 use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
mysqld-bin.000001 339 Gtid 1 387 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:1'
mysqld-bin.000001 387 Query 1 503 use `test`; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 503 Gtid 1 551 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:2'
mysqld-bin.000001 551 Query 1 628 BEGIN
mysqld-bin.000001 628 Table_map 1 673 table_id: # (test.t2)
mysqld-bin.000001 673 Write_rows 1 713 table_id: # flags: STMT_END_F
mysqld-bin.000001 713 Xid 1 744 COMMIT /* xid=# */
mysqld-bin.000001 744 Gtid 1 792 SET @@SESSION.GTID_NEXT= '<local_uuid>:2'
mysqld-bin.000001 792 Query 1 927 use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
mysqld-bin.000001 927 Gtid 1 975 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:3'
mysqld-bin.000001 975 Query 1 1090 use `test`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 1090 Gtid 1 1138 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:4'
mysqld-bin.000001 1138 Query 1 1254 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 1254 Gtid 1 1302 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:5'
mysqld-bin.000001 1302 Query 1 1379 BEGIN
mysqld-bin.000001 1379 Table_map 1 1424 table_id: # (test.t1)
mysqld-bin.000001 1424 Write_rows 1 1464 table_id: # flags: STMT_END_F
mysqld-bin.000001 1464 Xid 1 1495 COMMIT /* xid=# */
mysqld-bin.000001 1495 Gtid 1 1543 SET @@SESSION.GTID_NEXT= '<local_uuid>:3'
mysqld-bin.000001 1543 Query 1 1678 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
mysqld-bin.000001 1678 Gtid 1 1726 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:6'
mysqld-bin.000001 1726 Query 1 1841 use `test`; DROP TABLE `t1` /* generated by server */
mysqld-bin.000001 1841 Gtid 1 1889 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:7'
mysqld-bin.000001 1889 Query 1 2005 use `test`; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 2005 Gtid 1 2053 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:8'
mysqld-bin.000001 2053 Query 1 2130 BEGIN
mysqld-bin.000001 2130 Table_map 1 2175 table_id: # (test.t2)
mysqld-bin.000001 2175 Write_rows 1 2215 table_id: # flags: STMT_END_F
mysqld-bin.000001 2215 Xid 1 2246 COMMIT /* xid=# */
mysqld-bin.000001 2246 Gtid 1 2294 SET @@SESSION.GTID_NEXT= '<local_uuid>:4'
mysqld-bin.000001 2294 Query 1 2434 use `test`; DROP TEMPORARY TABLE IF EXISTS `t1`,`t3` /* generated by server */
mysqld-bin.000001 2434 Gtid 1 2482 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:9'
mysqld-bin.000001 2482 Query 1 2597 use `test`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 2597 Gtid 1 2645 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:10'
mysqld-bin.000001 2645 Query 1 2761 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 2761 Gtid 1 2809 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:11'
mysqld-bin.000001 2809 Query 1 2886 BEGIN
mysqld-bin.000001 2886 Table_map 1 2931 table_id: # (test.t1)
mysqld-bin.000001 2931 Write_rows 1 2971 table_id: # flags: STMT_END_F
mysqld-bin.000001 2971 Xid 1 3002 COMMIT /* xid=# */
mysqld-bin.000001 3002 Gtid 1 3050 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:12'
mysqld-bin.000001 3050 Query 1 3166 use `test`; CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 3166 Gtid 1 3214 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:13'
mysqld-bin.000001 3214 Query 1 3291 BEGIN
mysqld-bin.000001 3291 Table_map 1 3336 table_id: # (test.t3)
mysqld-bin.000001 3336 Write_rows 1 3376 table_id: # flags: STMT_END_F
mysqld-bin.000001 3376 Xid 1 3407 COMMIT /* xid=# */
mysqld-bin.000001 3407 Gtid 1 3455 SET @@SESSION.GTID_NEXT= '<local_uuid>:5'
mysqld-bin.000001 3455 Query 1 3590 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
mysqld-bin.000001 3590 Gtid 1 3638 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:14'
mysqld-bin.000001 3638 Query 1 3758 use `test`; DROP TABLE `t1`,`t3` /* generated by server */
mysqld-bin.000001 3758 Gtid 1 3806 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:15'
mysqld-bin.000001 3806 Query 1 3922 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 3922 Gtid 1 3970 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:16'
mysqld-bin.000001 3970 Query 1 4047 BEGIN
mysqld-bin.000001 4047 Table_map 1 4092 table_id: # (test.t1)
mysqld-bin.000001 4092 Write_rows 1 4132 table_id: # flags: STMT_END_F
mysqld-bin.000001 4132 Xid 1 4163 COMMIT /* xid=# */
mysqld-bin.000001 4163 Gtid 1 4211 SET @@SESSION.GTID_NEXT= '<local_uuid>:6'
mysqld-bin.000001 4211 Query 1 4351 use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
mysqld-bin.000001 4351 Gtid 1 4399 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:17'
mysqld-bin.000001 4399 Query 1 4514 use `test`; DROP TABLE `t1` /* generated by server */
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 120 Previous_gtids 2 151
mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:1'
mysqld-bin.000001 199 Query 1 315 use `test`; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 315 Gtid 1 363 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:2'
mysqld-bin.000001 363 Query 1 431 BEGIN
mysqld-bin.000001 431 Table_map 1 476 table_id: # (test.t2)
mysqld-bin.000001 476 Write_rows 1 516 table_id: # flags: STMT_END_F
mysqld-bin.000001 516 Xid 1 547 COMMIT /* xid=# */
mysqld-bin.000001 547 Gtid 1 595 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:3'
mysqld-bin.000001 595 Query 1 710 use `test`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 710 Gtid 1 758 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:4'
mysqld-bin.000001 758 Query 1 874 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 874 Gtid 1 922 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:5'
mysqld-bin.000001 922 Query 1 990 BEGIN
mysqld-bin.000001 990 Table_map 1 1035 table_id: # (test.t1)
mysqld-bin.000001 1035 Write_rows 1 1075 table_id: # flags: STMT_END_F
mysqld-bin.000001 1075 Xid 1 1106 COMMIT /* xid=# */
mysqld-bin.000001 1106 Gtid 1 1154 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:6'
mysqld-bin.000001 1154 Query 1 1269 use `test`; DROP TABLE `t1` /* generated by server */
mysqld-bin.000001 1269 Gtid 1 1317 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:7'
mysqld-bin.000001 1317 Query 1 1433 use `test`; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 1433 Gtid 1 1481 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:8'
mysqld-bin.000001 1481 Query 1 1549 BEGIN
mysqld-bin.000001 1549 Table_map 1 1594 table_id: # (test.t2)
mysqld-bin.000001 1594 Write_rows 1 1634 table_id: # flags: STMT_END_F
mysqld-bin.000001 1634 Xid 1 1665 COMMIT /* xid=# */
mysqld-bin.000001 1665 Gtid 1 1713 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:9'
mysqld-bin.000001 1713 Query 1 1828 use `test`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 1828 Gtid 1 1876 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:10'
mysqld-bin.000001 1876 Query 1 1992 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 1992 Gtid 1 2040 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:11'
mysqld-bin.000001 2040 Query 1 2108 BEGIN
mysqld-bin.000001 2108 Table_map 1 2153 table_id: # (test.t1)
mysqld-bin.000001 2153 Write_rows 1 2193 table_id: # flags: STMT_END_F
mysqld-bin.000001 2193 Xid 1 2224 COMMIT /* xid=# */
mysqld-bin.000001 2224 Gtid 1 2272 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:12'
mysqld-bin.000001 2272 Query 1 2388 use `test`; CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 2388 Gtid 1 2436 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:13'
mysqld-bin.000001 2436 Query 1 2504 BEGIN
mysqld-bin.000001 2504 Table_map 1 2549 table_id: # (test.t3)
mysqld-bin.000001 2549 Write_rows 1 2589 table_id: # flags: STMT_END_F
mysqld-bin.000001 2589 Xid 1 2620 COMMIT /* xid=# */
mysqld-bin.000001 2620 Gtid 1 2668 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:14'
mysqld-bin.000001 2668 Query 1 2788 use `test`; DROP TABLE `t1`,`t3` /* generated by server */
mysqld-bin.000001 2788 Gtid 1 2836 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:15'
mysqld-bin.000001 2836 Query 1 2952 use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 2952 Gtid 1 3000 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:16'
mysqld-bin.000001 3000 Query 1 3068 BEGIN
mysqld-bin.000001 3068 Table_map 1 3113 table_id: # (test.t1)
mysqld-bin.000001 3113 Write_rows 1 3153 table_id: # flags: STMT_END_F
mysqld-bin.000001 3153 Xid 1 3184 COMMIT /* xid=# */
mysqld-bin.000001 3184 Gtid 1 3232 SET @@SESSION.GTID_NEXT= '<cluster_uuid>:17'
mysqld-bin.000001 3232 Query 1 3347 use `test`; DROP TABLE `t1` /* generated by server */
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t_wait1 VALUES (1);
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SHOW BINARY LOGS;
SHOW BINLOG EVENTS;
SHOW COLUMNS FROM t1;
SHOW CREATE EVENT e1;
SHOW CREATE FUNCTION f1;
SHOW CREATE PROCEDURE p1;
SHOW CREATE TABLE t1;
SHOW CREATE TRIGGER tr1;
SHOW CREATE VIEW v1;
SHOW DATABASES;
SHOW ENGINE InnoDB STATUS;
SHOW FUNCTION CODE f1;
SHOW FUNCTION STATUS;
SHOW GRANTS FOR 'root'@'localhost';
SHOW INDEX FROM t1;
SHOW OPEN TABLES;
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';
SHOW WARNINGS;
SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait1;
SET GLOBAL debug = NULL;
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
CREATE DATABASE db1;
SHOW BINARY LOGS;
SHOW BINLOG EVENTS;
SHOW COLUMNS FROM t1;
SHOW CREATE DATABASE db1;
SHOW CREATE EVENT e1;
SHOW CREATE FUNCTION f1;
SHOW CREATE PROCEDURE p1;
SHOW CREATE TABLE t1;
SHOW CREATE TRIGGER tr1;
SHOW CREATE VIEW v1;
SHOW DATABASES;
SHOW ENGINE InnoDB STATUS;
SHOW FUNCTION CODE f1;
SHOW FUNCTION STATUS;
SHOW GRANTS FOR 'root'@'localhost';
SHOW INDEX FROM t1;
SHOW OPEN TABLES;
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';
SHOW WARNINGS;
SET GLOBAL DEBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
SET SESSION wsrep_sync_wait = 8;
DROP DATABASE db1;
SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t_wait8 VALUES (1);
SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
SET SESSION wsrep_sync_wait = 8;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
CREATE TABLE q (f1 INTEGER) ENGINE=InnoDB;
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SHOW BINARY LOGS;
SHOW BINLOG EVENTS;
SHOW COLUMNS FROM t1;
......@@ -61,5 +35,16 @@ SHOW TABLES;
SHOW TRIGGERS;
SHOW GLOBAL VARIABLES LIKE 'foo_bar';
SHOW WARNINGS;
SET GLOBAL DEBUG = "";
SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait8;
SET GLOBAL debug = NULL;
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
--gtid-mode=ON --log-bin --log-slave-updates --enforce-gtid-consistency
#
# MW-360 DROP TABLE containing temporary tables results in binlog divergence
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--connection node_1
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_2
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_1
#
# Straightforward temporary table
#
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
--let $local_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
#
# A mix of normal and temporary tables
#
# Temp table first, normal table second
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
DROP TABLE t1, t2;
# Normal table first, temporary table second
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
DROP TABLE t1, t2;
# Temporary table first, normal table second, temp table third
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
CREATE TEMPORARY TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
DROP TABLE t1, t2, t3;
# Normal table first, temporary table second, normal table third
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (2);
CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
DROP TABLE t1, t2, t3;
#
# A temporary table masking a normal one
#
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2);
DROP TABLE t1;
DROP TABLE t1;
--connection node_2
--let $cluster_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
--connection node_1
--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
--replace_result $local_uuid <local_uuid> $cluster_uuid <cluster_uuid>
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
--connection node_2
--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
--replace_result $local_uuid <local_uuid> $cluster_uuid <cluster_uuid>
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
#
# 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;
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
#
# Test 1: SHOW commands no longer obey wsrep_sync_wait = 1
# SHOW commands now obey wsrep_sync_wait = 8 (WSREP_SYNC_WAIT_BEFORE_SHOW)
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
--source include/have_debug_sync.inc
--connection node_2
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
--disable_result_log
--connection node_1
CREATE DATABASE db1;
--connection node_2
SHOW BINARY LOGS;
SHOW BINLOG EVENTS;
--error ER_NO_SUCH_TABLE
SHOW COLUMNS FROM t1;
--error ER_BAD_DB_ERROR
SHOW CREATE DATABASE db1;
--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;
SET GLOBAL DEBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
# Make sure no signals have been leftover from previous tests to surprise us.
SELECT @@debug_sync;
SET SESSION wsrep_sync_wait = 8;
DROP DATABASE db1;
SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
#
# Test 2: SHOW commands now obey wsrep_sync_wait = 8
#
--connection node_1
CREATE TABLE t_wait8 (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_wait8 VALUES (1);
--connection node_2
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
SET SESSION wsrep_sync_wait = 8;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
--connection node_1
CREATE TABLE q (f1 INTEGER) ENGINE=InnoDB;
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--disable_result_log
--connection node_2
--error ER_LOCK_WAIT_TIMEOUT
SHOW BINARY LOGS;
......@@ -177,11 +105,24 @@ SHOW GLOBAL VARIABLES LIKE 'foo_bar';
--error 0
SHOW WARNINGS;
SET GLOBAL DEBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--enable_result_log
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig"
--enable_query_log
# Unblock the background INSERT and remove the sync point.
SET GLOBAL debug = "-d,sync.wsrep_apply_cb";
SET 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_wait8;
SET GLOBAL debug = NULL;
SET debug_sync='RESET';
SET SESSION wsrep_sync_wait = 15;
DROP TABLE q;
# Make sure no pending signals are leftover to surprise subsequent tests.
SELECT @@debug_sync;
......@@ -1635,12 +1635,6 @@ void THD::init(void)
wsrep_affected_rows = 0;
wsrep_replicate_GTID = false;
wsrep_skip_wsrep_GTID = false;
/*
@@wsrep_causal_reads is now being handled via wsrep_sync_wait, update it
appropriately.
*/
if (variables.wsrep_causal_reads)
variables.wsrep_sync_wait|= WSREP_SYNC_WAIT_BEFORE_READ;
#endif /* WITH_WSREP */
if (variables.sql_log_bin)
......
......@@ -2756,6 +2756,7 @@ mysql_execute_command(THD *thd)
#endif
case SQLCOM_SHOW_STATUS:
{
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
execute_show_status(thd, all_tables);
break;
}
......@@ -5808,11 +5809,10 @@ static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
bool res;
system_status_var old_status_var= thd->status_var;
thd->initial_status_var= &old_status_var;
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
if (!(res= check_table_access(thd, SELECT_ACL, all_tables, FALSE,
UINT_MAX, FALSE)))
res= execute_sqlcom_select(thd, all_tables);
error:
/* Don't log SHOW STATUS commands to slow query log */
thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED |
SERVER_QUERY_NO_GOOD_INDEX_USED);
......
......@@ -224,7 +224,8 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
{
const char act[]=
"now "
"wait_for signal.wsrep_apply_cb";
"SIGNAL sync.wsrep_apply_cb_reached "
"WAIT_FOR signal.wsrep_apply_cb";
DBUG_ASSERT(!debug_sync_set_action(thd,
STRING_WITH_LEN(act)));
};);
......
......@@ -809,8 +809,6 @@ bool wsrep_must_sync_wait (THD* thd, uint mask)
{
return (thd->variables.wsrep_sync_wait & mask) &&
thd->variables.wsrep_on &&
!(thd->variables.wsrep_dirty_reads &&
!is_update_query(thd->lex->sql_command)) &&
!thd->in_active_multi_stmt_transaction() &&
thd->wsrep_conflict_state != REPLAYING &&
thd->wsrep_sync_wait_gtid.seqno == WSREP_SEQNO_UNDEFINED;
......
......@@ -64,19 +64,21 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type)
{
// wsrep_sync_wait should also be updated.
if (var_type == OPT_GLOBAL) {
if (global_system_variables.wsrep_causal_reads) {
global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
// global setting should not affect session setting.
// if (var_type == OPT_GLOBAL) {
// thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads;
// }
if (thd->variables.wsrep_causal_reads) {
thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
if (thd->variables.wsrep_causal_reads) {
thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
// update global settings too.
if (global_system_variables.wsrep_causal_reads) {
global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
return false;
......@@ -84,14 +86,17 @@ bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type)
bool wsrep_sync_wait_update (sys_var* self, THD* thd, enum_var_type var_type)
{
// wsrep_causal_reads should also be updated.
if (var_type == OPT_GLOBAL) {
global_system_variables.wsrep_causal_reads=
global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ;
} else {
thd->variables.wsrep_causal_reads=
thd->variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ;
}
// global setting should not affect session setting.
// if (var_type == OPT_GLOBAL) {
// thd->variables.wsrep_sync_wait = global_system_variables.wsrep_sync_wait;
// }
thd->variables.wsrep_causal_reads = thd->variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ;
// update global settings too
global_system_variables.wsrep_causal_reads = global_system_variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ;
return false;
}
......
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