2017-07-11 12:55:03 +02:00
|
|
|
--source include/galera_cluster.inc
|
2020-06-15 08:29:17 +02:00
|
|
|
--source include/have_debug.inc
|
2017-11-08 16:22:11 +01:00
|
|
|
--source include/have_debug_sync.inc
|
2020-06-15 08:29:17 +02:00
|
|
|
--source include/galera_have_debug_sync.inc
|
2017-07-11 12:55:03 +02:00
|
|
|
|
|
|
|
--connection node_1
|
|
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
|
|
|
|
|
|
|
|
DELIMITER |;
|
|
|
|
CREATE PROCEDURE insert_proc ()
|
|
|
|
BEGIN
|
|
|
|
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
|
|
BEGIN
|
|
|
|
GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
|
|
|
|
END;
|
|
|
|
INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1');
|
|
|
|
INSERT INTO t1 VALUES (3, 'node 1');
|
|
|
|
END|
|
|
|
|
DELIMITER ;|
|
|
|
|
|
2017-08-24 09:34:21 +02:00
|
|
|
# We need two slave threads here to guarantee progress.
|
|
|
|
# If we use only one thread the following could happen
|
|
|
|
# in node_1:
|
|
|
|
# We block the only slave thread in wsrep_apply_cb and we
|
|
|
|
# issue an INSERT (by calling the stored procedure) that will
|
|
|
|
# try to acquire galera's local monitor in pre_commit().
|
|
|
|
# This usually works fine, except for when a commit cut event
|
|
|
|
# sneaks in the slave queue and gets a local seqno smaller than
|
|
|
|
# that of the INSERT. Because there is only one slave thread,
|
|
|
|
# commit cut is not processed and therefore does not advance
|
|
|
|
# local monitor, and our INSERT remains stuck there.
|
2019-02-27 12:15:03 +01:00
|
|
|
|
2017-08-24 09:34:21 +02:00
|
|
|
SET GLOBAL wsrep_slave_threads = 2;
|
2017-12-07 20:10:51 +01:00
|
|
|
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
|
2017-07-11 12:55:03 +02:00
|
|
|
|
2020-01-10 11:55:30 +01:00
|
|
|
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
|
|
|
|
|
2017-07-11 12:55:03 +02:00
|
|
|
--connection node_2
|
|
|
|
--send INSERT INTO t1 VALUES (1, 'node 2');
|
|
|
|
|
|
|
|
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
|
|
|
--connection node_1a
|
|
|
|
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
|
|
|
|
|
|
|
|
--connection node_1
|
|
|
|
SET SESSION wsrep_sync_wait = 0;
|
|
|
|
--send CALL insert_proc ();
|
|
|
|
|
|
|
|
--connection node_1a
|
2020-01-10 11:55:30 +01:00
|
|
|
SET SESSION wsrep_sync_wait = 0;
|
|
|
|
--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
|
2017-08-24 09:34:21 +02:00
|
|
|
|
2017-07-11 12:55:03 +02:00
|
|
|
|
2017-12-07 20:10:51 +01:00
|
|
|
SET GLOBAL DEBUG_DBUG = "";
|
2017-07-11 12:55:03 +02:00
|
|
|
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
|
|
|
|
|
|
|
--connection node_2
|
|
|
|
--reap
|
|
|
|
|
|
|
|
--connection node_1
|
|
|
|
# We expect no errors here, because the handler in insert_proc() caught the deadlock error
|
|
|
|
--reap
|
2017-08-24 09:34:21 +02:00
|
|
|
SELECT @errno = 1213;
|
2017-07-11 12:55:03 +02:00
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
--connection node_2
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
2017-08-24 09:34:21 +02:00
|
|
|
--connection node_1
|
|
|
|
SET GLOBAL wsrep_slave_threads = DEFAULT;
|
2017-07-11 12:55:03 +02:00
|
|
|
DROP TABLE t1;
|
2017-11-08 13:15:54 +01:00
|
|
|
DROP PROCEDURE insert_proc;
|
|
|
|
|
2017-12-07 20:10:51 +01:00
|
|
|
SET GLOBAL debug_dbug = NULL;
|
2017-11-08 13:15:54 +01:00
|
|
|
SET debug_sync='RESET';
|
|
|
|
|
|
|
|
# Make sure no pending signals are leftover to surprise subsequent tests.
|
|
|
|
SELECT @@debug_sync;
|