| 1 |
# |
| 2 |
# Test various executions which go through binlog group commit |
| 3 |
# |
| 4 |
|
| 5 |
--source include/galera_cluster.inc |
| 6 |
--source include/have_debug.inc |
| 7 |
--source include/have_debug_sync.inc |
| 8 |
--source include/galera_have_debug_sync.inc |
| 9 |
|
| 10 |
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; |
| 11 |
|
| 12 |
--let $galera_connection_name = ctrl |
| 13 |
--let $galera_server_number = 1 |
| 14 |
--source include/galera_connect.inc |
| 15 |
|
| 16 |
# Scenario 1: Block INSERT after commit order release after queued for |
| 17 |
# group commit. Verify that |
| 18 |
# |
| 19 |
# - wsrep_last_committed is not advanced before commit finishes |
| 20 |
# - The INSERT does not become visible before commit finishes |
| 21 |
|
| 22 |
# Turn off sync wait to avoid blocking and use wsrep_last_committed |
| 23 |
# to observe gtid position. |
| 24 |
SET SESSION wsrep_sync_wait = 0; |
| 25 |
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 26 |
--connection node_1 |
| 27 |
SET SESSION wsrep_sync_wait = 0; |
| 28 |
# Set up sync points |
| 29 |
SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached WAIT_FOR bcol_continue"; |
| 30 |
SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached WAIT_FOR acol_continue"; |
| 31 |
SET DEBUG_SYNC = "after_group_after_commit SIGNAL after_group_reached WAIT_FOR after_group_continue"; |
| 32 |
# Send insert which will block in the sync points above |
| 33 |
--send INSERT INTO t1 VALUES (1) |
| 34 |
|
| 35 |
--connection ctrl |
| 36 |
# INSERT has gone through wsrep_ordered_commit() and the transaction is |
| 37 |
# committed in memory. |
| 38 |
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached"; |
| 39 |
--disable_query_log |
| 40 |
--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' |
| 41 |
--enable_query_log |
| 42 |
SELECT * FROM t1; |
| 43 |
SET DEBUG_SYNC = "now SIGNAL bcol_continue"; |
| 44 |
|
| 45 |
# SE commit finished but wsrep_after_commit() has not called yet. |
| 46 |
SET DEBUG_SYNC = "now WAIT_FOR acol_reached"; |
| 47 |
--disable_query_log |
| 48 |
--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' |
| 49 |
--enable_query_log |
| 50 |
SELECT * FROM t1; |
| 51 |
SET DEBUG_SYNC = "now SIGNAL acol_continue"; |
| 52 |
|
| 53 |
SET DEBUG_SYNC = "now WAIT_FOR after_group_reached"; |
| 54 |
--disable_query_log |
| 55 |
--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' |
| 56 |
--enable_query_log |
| 57 |
SET DEBUG_SYNC = "now SIGNAL after_group_continue"; |
| 58 |
|
| 59 |
--connection node_1 |
| 60 |
--reap |
| 61 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1; |
| 62 |
--source include/wait_condition.inc |
| 63 |
SELECT * from t1; |
| 64 |
|
| 65 |
--connection ctrl |
| 66 |
SET DEBUG_SYNC = "RESET"; |
| 67 |
|
| 68 |
# |
| 69 |
# Scenario 2: Verify that two INSERTs from two different connections |
| 70 |
# queue for commit. |
| 71 |
# |
| 72 |
--let $galera_connection_name = node_1a |
| 73 |
--let $galera_server_number = 1 |
| 74 |
--source include/galera_connect.inc |
| 75 |
SET SESSION wsrep_sync_wait = 0; |
| 76 |
|
| 77 |
--connection ctrl |
| 78 |
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 79 |
|
| 80 |
--connection node_1 |
| 81 |
SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_1 WAIT_FOR bcol_continue_1"; |
| 82 |
SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_1 WAIT_FOR acol_continue_1"; |
| 83 |
SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_1 WAIT_FOR agac_continue_1"; |
| 84 |
--send INSERT INTO t1 VALUES (2); |
| 85 |
--connection ctrl |
| 86 |
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_1"; |
| 87 |
|
| 88 |
--disable_query_log |
| 89 |
--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' |
| 90 |
--enable_query_log |
| 91 |
|
| 92 |
--connection node_1a |
| 93 |
SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_2 WAIT_FOR bcol_continue_2"; |
| 94 |
SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_2 WAIT_FOR acol_continue_2"; |
| 95 |
SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_2 WAIT_FOR agac_continue_2"; |
| 96 |
--send INSERT INTO t1 VALUES (3); |
| 97 |
|
| 98 |
# Now INSERTs are queued, node_1 waiting after releasing commit order, |
| 99 |
# node_1a waiting before releasing commit order. |
| 100 |
--connection ctrl |
| 101 |
SET DEBUG_SYNC = "now SIGNAL bcol_continue_1"; |
| 102 |
SET DEBUG_SYNC = "now WAIT_FOR acol_reached_1"; |
| 103 |
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_2"; |
| 104 |
|
| 105 |
--disable_query_log |
| 106 |
--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' |
| 107 |
--enable_query_log |
| 108 |
|
| 109 |
SET DEBUG_SYNC = "now SIGNAL bcol_continue_2"; |
| 110 |
SET DEBUG_SYNC = "now WAIT_FOR acol_reached_2"; |
| 111 |
|
| 112 |
--disable_query_log |
| 113 |
--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' |
| 114 |
--enable_query_log |
| 115 |
|
| 116 |
# Last seen GTIDs are incremented one by one once after_group_after_commit |
| 117 |
# is reached. |
| 118 |
SET DEBUG_SYNC = "now SIGNAL acol_continue_1"; |
| 119 |
SET DEBUG_SYNC = "now WAIT_FOR agac_reached_1"; |
| 120 |
|
| 121 |
--disable_query_log |
| 122 |
--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' |
| 123 |
--enable_query_log |
| 124 |
|
| 125 |
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 126 |
SET DEBUG_SYNC = "now SIGNAL acol_continue_2"; |
| 127 |
SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2"; |
| 128 |
--disable_query_log |
| 129 |
--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' |
| 130 |
--enable_query_log |
| 131 |
|
| 132 |
SET DEBUG_SYNC = "now SIGNAL agac_continue_1"; |
| 133 |
|
| 134 |
--connection node_1 |
| 135 |
--reap |
| 136 |
|
| 137 |
--connection ctrl |
| 138 |
SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; |
| 139 |
|
| 140 |
--connection node_1a |
| 141 |
--reap |
| 142 |
|
| 143 |
--connection ctrl |
| 144 |
SET DEBUG_SYNC = "RESET"; |
| 145 |
|
| 146 |
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1; |
| 147 |
--source include/wait_condition.inc |
| 148 |
SELECT * from t1; |
| 149 |
|
| 150 |
DROP TABLE t1; |
| 151 |
|
| 152 |
--disconnect ctrl |
| 153 |
--disconnect node_1a |
| 154 |
--source include/galera_end.inc |