MINI MINI MANI MO
################################################################################
# This test intends to prove that group replication channels are not affected
# by START SLAVE and STOP SLAVE commands.
#
# Test:
# 0) The test requires three servers: M1 and M2.
# 1) Bootstrap start a group on M1. Start GR on M2.
# 2) Create a slave channel 'channel_1' on M1 (M3 -> M1). Verify that both slave
# channel and group_replication_applier channel are present on M1.
# 3) With a running slave channel and group replication active do a STOP SLAVE.
# The slave channel should stop but the group replication channel shouldn't.
# 4) With a stopped slave channel and group replication off do a START SLAVE.
# The slave channel should start but the group replication channel shouldn't.
# 5) Restart the server with no automatic plugin start.
# The slave channel should start but the group replication channel shouldn't.
# 6) Clean up.
################################################################################
--source ../inc/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source ../inc/group_replication.inc
#
# Phase 1: Start group replication on two servers
#
--connection server1
--echo server1
--source ../inc/start_and_bootstrap_group_replication.inc
--connection server2
--echo server2
--source include/start_group_replication.inc
--connection server1
--let $group_replication_number_of_members= 2
--source ../inc/gr_wait_for_number_of_members.inc
#
# Phase 2: Create a slave channel in server 1 and verify that 2 channels exist
#
--replace_result $SERVER_MYPORT_3 SERVER_3_PORT
--eval CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER="root", MASTER_PASSWORD="", MASTER_PORT=$SERVER_MYPORT_3, MASTER_AUTO_POSITION=1 FOR CHANNEL "channel_1"
--source include/start_slave.inc
--let $assert_text= 'The group replication applier channel is present'
--let $assert_cond= [SELECT COUNT(*) AS count FROM mysql.slave_relay_log_info WHERE channel_name="group_replication_applier", count, 1] = 1
--source include/assert.inc
--let $assert_text= 'The created slave channel is present'
--let $assert_cond= [SELECT COUNT(*) AS count FROM mysql.slave_relay_log_info WHERE channel_name="channel_1", count, 1] = 1
--source include/assert.inc
#
# Phase 3: Check that after doing a stop slave, the applier channel is still ON
#
--let $assert_text= 'The group replication applier channel is ON'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="ON", count, 1] = 1
--source include/assert.inc
--source include/stop_slave.inc
--let $assert_text= 'The group replication applier channel is still ON'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="ON", count, 1] = 1
--source include/assert.inc
--let $assert_text= 'The created slave channel is OFF'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="OFF", count, 1] = 1
--source include/assert.inc
#
# Phase 4: After being stopped, check that after a START SLAVE the plugin channel is still OFF
#
--source include/stop_group_replication.inc
--let $assert_text= 'The group replication applier channel is OFF'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
--source include/assert.inc
--source include/start_slave.inc
--let $assert_text= 'The group replication applier channel is still OFF'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
--source include/assert.inc
--let $assert_text= 'The created slave channel is ON'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="ON", count, 1] = 1
--source include/assert.inc
#
# Phase 5: On restart, only the slave channel should start
#
--connection server1
--let $allow_rpl_inited=1
--source include/restart_mysqld.inc
#Needed as we are not using rpl_restart_server.inc
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
# Wait for the slave channel start
--let $rpl_channel_name= channel_1
--source include/wait_for_slave_to_start.inc
--let $rpl_channel_name=
--let $assert_text= 'The group replication applier channel is still OFF'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
--source include/assert.inc
--let $assert_text= 'The created slave channel is ON'
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="ON", count, 1] = 1
--source include/assert.inc
#
# Phase 6: Clean the created channels
#
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_AUTO_POSITION=0 FOR CHANNEL "channel_1";
--connection server1
--let $skip_restore_connection= 0
--source ../inc/group_replication_end.inc
OHA YOOOO