| 1 |
####################################################################################### |
| 2 |
# Test that Group Replication activity is properly shown on a GR member |
| 3 |
# |
| 4 |
# Test : |
| 5 |
# 0. This test requires 2 servers, M1 and M2 |
| 6 |
# 1. Start GR on M1 |
| 7 |
# 2. Block sql thread for CHANNEL 'group_replication_applier' on M1 |
| 8 |
# 3. Perform some DDL/DML operations on M1 |
| 9 |
# 4. Start GR on another server M2 |
| 10 |
# 5. Verify GR activity through 'SHOW PROCESSLIST' on M1 and M2 |
| 11 |
# 6. Verify GR activity through select from INFORMATION_SCHEMA.PROCESSLIST on M1 and M2 |
| 12 |
# 7. Clean-up |
| 13 |
####################################################################################### |
| 14 |
--source include/have_debug_sync.inc |
| 15 |
--source include/have_group_replication_plugin.inc |
| 16 |
--let $rpl_skip_group_replication_start= 1 |
| 17 |
--let $rpl_server_count= 2 |
| 18 |
--source include/group_replication.inc |
| 19 |
|
| 20 |
# Start GR on M1 |
| 21 |
--echo |
| 22 |
--let $rpl_connection_name= server1 |
| 23 |
--source include/rpl_connection.inc |
| 24 |
--source include/start_and_bootstrap_group_replication.inc |
| 25 |
|
| 26 |
# Block slave sql_thread for group replication applier channel |
| 27 |
# This is to ensure M2 goes to RECOVERING state, so that GR activity corresponding to this state can be verified |
| 28 |
--echo |
| 29 |
SET @@GLOBAL.DEBUG='+d,block_applier_updates'; |
| 30 |
|
| 31 |
# Do some DDL, DML operations |
| 32 |
--echo |
| 33 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 34 |
--disable_query_log |
| 35 |
--let $i=10 |
| 36 |
while($i) |
| 37 |
{ |
| 38 |
--EVAL INSERT INTO t1 VALUES ($i) |
| 39 |
--dec $i |
| 40 |
} |
| 41 |
--enable_query_log |
| 42 |
|
| 43 |
# Start GR on M2 |
| 44 |
--echo |
| 45 |
--let $rpl_connection_name= server2 |
| 46 |
--source include/rpl_connection.inc |
| 47 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 48 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 49 |
--source include/start_group_replication_command.inc |
| 50 |
|
| 51 |
# Wait for the table to get synced to M2 |
| 52 |
--let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't1'; |
| 53 |
--source include/wait_condition.inc |
| 54 |
|
| 55 |
--echo |
| 56 |
--let $rpl_connection_name= server1 |
| 57 |
--source include/rpl_connection.inc |
| 58 |
# Verify GR activity on M1 using SHOW PROCESSLIST; |
| 59 |
--let $show_statement= SHOW PROCESSLIST; |
| 60 |
let $field= State; |
| 61 |
let $condition= = 'Source has sent all binlog to replica; waiting for more updates'; |
| 62 |
--source include/wait_show_condition.inc |
| 63 |
# Verify GR activity on M1 using select from INFORMATION_SCHEMA.PROCESSLIST |
| 64 |
--echo "Verifying GR activity on M1 by checking if master has sent all binlog to replica" |
| 65 |
--let $wait_condition= SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='Source has sent all binlog to replica; waiting for more updates'; |
| 66 |
--source include/wait_condition.inc |
| 67 |
|
| 68 |
--echo |
| 69 |
--let $rpl_connection_name= server2 |
| 70 |
--source include/rpl_connection.inc |
| 71 |
# Verify GR activity on M2 using SHOW PROCESSLIST; |
| 72 |
let $show_statement= SHOW PROCESSLIST; |
| 73 |
let $field= State; |
| 74 |
let $condition= = 'Replica has read all relay log; waiting for more updates'; |
| 75 |
--source include/wait_show_condition.inc |
| 76 |
# Verify GR activity on M2 using select from INFORMATION_SCHEMA.PROCESSLIST |
| 77 |
--echo "Verifying GR activity on M2 by checking if slave has read all relay log" |
| 78 |
--let $wait_condition= SELECT COUNT(*)>=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State='Replica has read all relay log; waiting for more updates'; |
| 79 |
--source include/wait_condition.inc |
| 80 |
|
| 81 |
# Resume slave sql_thread for group replication applier channel |
| 82 |
--echo |
| 83 |
--let $rpl_connection_name= server1 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked"; |
| 86 |
SET @@GLOBAL.DEBUG='-d,block_applier_updates'; |
| 87 |
SET DEBUG_SYNC = "now SIGNAL resume_applier_read"; |
| 88 |
|
| 89 |
# Drop table |
| 90 |
DROP TABLE test.t1; |
| 91 |
|
| 92 |
SET DEBUG_SYNC= 'RESET'; |
| 93 |
|
| 94 |
--source include/group_replication_end.inc |