| 1 |
################################################################################ |
| 2 |
# === Purpose === |
| 3 |
# |
| 4 |
# This test verifies that parallel execution of STOP GROUP REPLICATION and |
| 5 |
# performance_schema queries are handled properly by the server. |
| 6 |
# |
| 7 |
# === Implementation === |
| 8 |
# |
| 9 |
# 1. The test requires two servers: M1, M2 |
| 10 |
# 2. Start 2 servers and add them to group replication group |
| 11 |
# 3. Send STOP GR command on M1 an halt the execution at a sync point using |
| 12 |
# debug_sync utility. |
| 13 |
# 4. Send performance_schema query on M1 from a parallel client. |
| 14 |
# 5. Verify that concurrent queries are properly handled by server. |
| 15 |
# 6. Verify the consistency of the P_S queries post STOP GR. |
| 16 |
# 6. Cleanup |
| 17 |
################################################################################ |
| 18 |
|
| 19 |
--source include/have_debug.inc |
| 20 |
--source include/have_debug_sync.inc |
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo # |
| 25 |
--echo # Set the necessary debug points required for the simulation. |
| 26 |
--echo # |
| 27 |
--let $rpl_connection_name= server1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 30 |
SET @@GLOBAL.DEBUG='+d,group_replication_hold_stop_before_leave_the_group'; |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Send STOP GR command. The query shall wait before |
| 34 |
--echo # "leave_group_and_terminate_plugin_modules()" function until it is signaled. |
| 35 |
--echo # |
| 36 |
--send STOP GROUP_REPLICATION |
| 37 |
|
| 38 |
--echo # |
| 39 |
--echo # Wait for STOP GR to reach the debug sync point. |
| 40 |
--echo # |
| 41 |
--let $rpl_connection_name= server_1_1 |
| 42 |
--source include/rpl_connection.inc |
| 43 |
SET DEBUG_SYNC= "now WAIT_FOR signal.stopping_before_leave_the_group"; |
| 44 |
|
| 45 |
--echo # |
| 46 |
--echo # Send PS query from different session. The query shall halt in |
| 47 |
--echo # "get_group_member_stats()" function. |
| 48 |
--echo # |
| 49 |
--let $rpl_connection_name= server_1 |
| 50 |
--source include/rpl_connection.inc |
| 51 |
SET @@GLOBAL.DEBUG= '+d,group_replication_get_group_member_stats'; |
| 52 |
--send SELECT * FROM performance_schema.replication_group_member_stats |
| 53 |
|
| 54 |
--echo # |
| 55 |
--echo # Block the PS query and allow STOP GR command to continue by |
| 56 |
--echo # signalling it. |
| 57 |
--echo # |
| 58 |
--let $rpl_connection_name= server_1_1 |
| 59 |
--source include/rpl_connection.inc |
| 60 |
SET DEBUG_SYNC= "now WAIT_FOR signal.reached_get_group_member_stats"; |
| 61 |
SET DEBUG_SYNC= "now SIGNAL signal.resume_stop_before_leave_the_group"; |
| 62 |
|
| 63 |
# Reap the STOP GR query. |
| 64 |
--let $rpl_connection_name= server1 |
| 65 |
--source include/rpl_connection.inc |
| 66 |
--reap |
| 67 |
|
| 68 |
--echo # |
| 69 |
--echo # Allow the PS query to continue. |
| 70 |
--echo # |
| 71 |
SET DEBUG_SYNC= "now SIGNAL signal.resume_get_group_member_stats"; |
| 72 |
|
| 73 |
# Reap the PS query. |
| 74 |
--disable_result_log |
| 75 |
--let $rpl_connection_name= server_1 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
--reap |
| 78 |
--enable_result_log |
| 79 |
|
| 80 |
--echo # |
| 81 |
--echo # Verify that MEMBER_STATE is OFFLINE on server_1. |
| 82 |
--echo # |
| 83 |
--let $rpl_connection_name= server_1 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
--let $assert_text= Verified that MEMBER_STATE is OFFLINE on server_1 |
| 86 |
--let $assert_cond= "[SELECT MEMBER_STATE FROM performance_schema.replication_group_members, MEMBER_STATE, 1]" = "OFFLINE" |
| 87 |
--source include/assert.inc |
| 88 |
|
| 89 |
--echo # |
| 90 |
--echo # Verify that MEMBER_STATE is ONLINE on server_2. |
| 91 |
--echo # |
| 92 |
--let $rpl_connection_name= server_2 |
| 93 |
--source include/rpl_connection.inc |
| 94 |
--let $assert_text= Verified that MEMBER_STATE is ONLINE on server_2 |
| 95 |
--let $assert_cond= "[SELECT MEMBER_STATE FROM performance_schema.replication_group_members, MEMBER_STATE, 1]" = "ONLINE" |
| 96 |
--source include/assert.inc |
| 97 |
|
| 98 |
# Cleanup |
| 99 |
--let $rpl_connection_name= server1 |
| 100 |
--source include/rpl_connection.inc |
| 101 |
SET GLOBAL DEBUG= @debug_save; |
| 102 |
SET DEBUG_SYNC= 'RESET'; |
| 103 |
--source include/group_replication_end.inc |