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