From 3f619478f796eddbba6e39502fe941b285dd97b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:00:34 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- mysql-test/suite/galera/t/MDEV-16509.test | 144 ++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 mysql-test/suite/galera/t/MDEV-16509.test (limited to 'mysql-test/suite/galera/t/MDEV-16509.test') diff --git a/mysql-test/suite/galera/t/MDEV-16509.test b/mysql-test/suite/galera/t/MDEV-16509.test new file mode 100644 index 00000000..078f1e95 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-16509.test @@ -0,0 +1,144 @@ +# +# Test various executions which go through binlog group commit +# + +--source include/galera_cluster.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +--let $galera_connection_name = ctrl +--let $galera_server_number = 1 +--source include/galera_connect.inc + +# Scenario 1: Block INSERT after commit order release after queued for +# group commit. Verify that +# +# - wsrep_last_committed is not advanced before commit finishes +# - The INSERT does not become visible before commit finishes + +# Turn off sync wait to avoid blocking and use wsrep_last_committed +# to observe gtid position. +SET SESSION wsrep_sync_wait = 0; +--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +# Set up sync points +SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached WAIT_FOR bcol_continue"; +SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached WAIT_FOR acol_continue"; +SET DEBUG_SYNC = "after_group_after_commit SIGNAL after_group_reached WAIT_FOR after_group_continue"; +# Send insert which will block in the sync points above +--send INSERT INTO t1 VALUES (1) + +--connection ctrl +# INSERT has gone through wsrep_ordered_commit() and the transaction is +# committed in memory. +SET DEBUG_SYNC = "now WAIT_FOR bcol_reached"; +--disable_query_log +--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log +SELECT * FROM t1; +SET DEBUG_SYNC = "now SIGNAL bcol_continue"; + +# SE commit finished but wsrep_after_commit() has not called yet. +SET DEBUG_SYNC = "now WAIT_FOR acol_reached"; +--disable_query_log +--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log +SELECT * FROM t1; +SET DEBUG_SYNC = "now SIGNAL acol_continue"; + +SET DEBUG_SYNC = "now WAIT_FOR after_group_reached"; +--disable_query_log +--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_do_not_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log +SET DEBUG_SYNC = "now SIGNAL after_group_continue"; + +--connection node_1 +--reap + +# +# Scenario 2: Verify that two INSERTs from two different connections +# queue for commit. +# +--let $galera_connection_name = node_1a +--let $galera_server_number = 1 +--source include/galera_connect.inc +SET SESSION wsrep_sync_wait = 0; + +--connection ctrl +--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_1 +SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_1 WAIT_FOR bcol_continue_1"; +SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_1 WAIT_FOR acol_continue_1"; +SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_1 WAIT_FOR agac_continue_1"; +--send INSERT INTO t1 VALUES (2); +--connection ctrl +SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_1"; + +--disable_query_log +--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log + +--connection node_1a +SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_2 WAIT_FOR bcol_continue_2"; +SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_2 WAIT_FOR acol_continue_2"; +SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_2 WAIT_FOR agac_continue_2"; +--send INSERT INTO t1 VALUES (3); + +# Now INSERTs are queued, node_1 waiting after releasing commit order, +# node_1a waiting before releasing commit order. +--connection ctrl +SET DEBUG_SYNC = "now SIGNAL bcol_continue_1"; +SET DEBUG_SYNC = "now WAIT_FOR acol_reached_1"; +SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_2"; + +--disable_query_log +--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log + +SET DEBUG_SYNC = "now SIGNAL bcol_continue_2"; +SET DEBUG_SYNC = "now WAIT_FOR acol_reached_2"; + +--disable_query_log +--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log + +# Last seen GTIDs are incremented one by one once after_group_after_commit +# is reached. +SET DEBUG_SYNC = "now SIGNAL acol_continue_1"; +SET DEBUG_SYNC = "now WAIT_FOR agac_reached_1"; + +--disable_query_log +--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log + +--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +SET DEBUG_SYNC = "now SIGNAL acol_continue_2"; +SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2"; +--disable_query_log +--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--enable_query_log + +SET DEBUG_SYNC = "now SIGNAL agac_continue_1"; + +--connection node_1 +--reap + +--connection ctrl +SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; + +--connection node_1a +--reap + +--connection ctrl +SET DEBUG_SYNC = "RESET"; + +DROP TABLE t1; + +--disconnect ctrl +--disconnect node_1a +--source include/galera_end.inc -- cgit v1.2.3