MTR tests for galera sync wait up to
This commit is contained in:
parent
3f154943db
commit
7d2138d4a4
38
mysql-test/suite/galera/r/galera_last_committed_id.result
Normal file
38
mysql-test/suite/galera/r/galera_last_committed_id.result
Normal file
@ -0,0 +1,38 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
wsrep_last_committed_id_match
|
||||
1
|
||||
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connection node_1a;
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection node_1;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
connection node_1a;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection node_1;
|
||||
wsrep_last_committed_id_match
|
||||
1
|
||||
SET AUTOCOMMIT=OFF;
|
||||
START TRANSACTION;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
wsrep_last_committed_id_match
|
||||
1
|
||||
COMMIT;
|
||||
wsrep_last_committed_id_advanced
|
||||
1
|
||||
wsrep_last_committed_id_advanced
|
||||
1
|
||||
SET AUTOCOMMIT=ON;
|
||||
DROP TABLE t1;
|
43
mysql-test/suite/galera/r/galera_sync_wait_upto.result
Normal file
43
mysql-test/suite/galera/r/galera_sync_wait_upto.result
Normal file
@ -0,0 +1,43 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(NULL);
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('a');
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(2);
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
connection node_2;
|
||||
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
|
||||
connection node_1;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
connection node_2;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
||||
connection node_2a;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
connection node_2;
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
gtid_current = gtid_first
|
||||
1
|
||||
SET GLOBAL DEBUG_DBUG = "";
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
seqno_current = seqno_second
|
||||
1
|
||||
SET DEBUG_SYNC = "RESET";
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
68
mysql-test/suite/galera/t/galera_last_committed_id.test
Normal file
68
mysql-test/suite/galera/t/galera_last_committed_id.test
Normal file
@ -0,0 +1,68 @@
|
||||
#
|
||||
# Tests functions WSREP_LAST_WRITTEN_GTID and WSREP_LAST_SEEN_GTID
|
||||
#
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
|
||||
# Returns -1 if no transactions have been run
|
||||
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_match;
|
||||
--enable_query_log
|
||||
|
||||
# WSREP_LAST_WRITTEN_GTID() should not be influenced by transactions committed
|
||||
# on other connections
|
||||
|
||||
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
||||
--connection node_1a
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--connection node_1
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
|
||||
# WSREP_LAST_SEEN_GTID() should be influenced by transactions committed
|
||||
# on other connections
|
||||
|
||||
--connection node_1a
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--disable_query_log
|
||||
--let $wsrep_last_committed_id_conn_1a = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--enable_query_log
|
||||
|
||||
--connection node_1
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_committed_id_conn_1a' AS wsrep_last_committed_id_match;
|
||||
--enable_query_log
|
||||
|
||||
# Should not advance while a transaction is in progress
|
||||
|
||||
SET AUTOCOMMIT=OFF;
|
||||
START TRANSACTION;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
|
||||
--disable_query_log
|
||||
--let $wsrep_last_committed_id_before = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--enable_query_log
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_committed_id_before' AS wsrep_last_committed_id_match;
|
||||
--enable_query_log
|
||||
|
||||
# Should only advance after the transaction has been committed
|
||||
|
||||
COMMIT;
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_advanced;
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_advanced;
|
||||
--enable_query_log
|
||||
SET AUTOCOMMIT=ON;
|
||||
|
||||
DROP TABLE t1;
|
@ -0,0 +1 @@
|
||||
--wsrep-sync-wait=0 --wsrep-causal-reads=OFF
|
115
mysql-test/suite/galera/t/galera_sync_wait_upto.test
Normal file
115
mysql-test/suite/galera/t/galera_sync_wait_upto.test
Normal file
@ -0,0 +1,115 @@
|
||||
#
|
||||
# Tests the wsrep_sync_wait_upto variable.
|
||||
#
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
|
||||
# Test with invalid values
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(NULL);
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('a');
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(2);
|
||||
|
||||
|
||||
# If set to low value, expect no waiting
|
||||
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('00000000-0000-0000-0000-000000000000:-1') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:0') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If set to current last_committed value
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:$seqno') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If set to very high value, will wait
|
||||
|
||||
--disable_query_log
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:9223372036854775807', 1) AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If applier is blocked, will wait
|
||||
|
||||
--connection node_2
|
||||
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
|
||||
|
||||
|
||||
--connection node_1
|
||||
# Perform two inserts and record the IDs of each
|
||||
INSERT INTO t1 VALUES (2);
|
||||
--let $gtid_first = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
|
||||
INSERT INTO t1 VALUES (3);
|
||||
--let $gtid_second = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
|
||||
--connection node_2
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
|
||||
--disable_query_log
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_first', 1) AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--send_eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_first') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
# Unblock applier
|
||||
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
||||
--connection node_2a
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE 'SELECT WSREP_SYNC_WAIT%';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
|
||||
--connection node_2
|
||||
--reap
|
||||
|
||||
# Confirm that we were allowed to proceed when the applier reached $seqno_first
|
||||
--let $gtid_current = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_current' = '$gtid_first' AS `gtid_current = gtid_first`
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL DEBUG_DBUG = "";
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
|
||||
# Move forward some more, to $seqno_second;
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_second') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--let $gtid_current = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_current' = '$gtid_second' AS `seqno_current = seqno_second`
|
||||
--enable_query_log
|
||||
|
||||
SET DEBUG_SYNC = "RESET";
|
||||
|
||||
--connection node_1
|
||||
DROP TABLE t1;
|
Loading…
x
Reference in New Issue
Block a user