MINI MINI MANI MO
################################################################################
# Validate that when a member is expelled from a group, its state is properly
# updated.
#
# Test:
# 0. The test requires three servers.
# 1. Suspend server 1 by sending a signal SIGSTOP to it.
# This will make server 1 to not answer to "I am alive"
# GCS messages and it will be expelled from the group.
# 2. Wait until group expel server 1.
# 3. Resume server 1 by sending a signal SIGCONT to it.
# Server will notice that was expelled from the group,
# will change to ERROR state and enabled super_read_only
# mode.
# 4. Stop and start server 1, it will be back to normal.
# 5. Check data.
# 6. Clean up.
################################################################################
# Test involves sending SIGSTOP and SIGCONT signals using kill Linux command.
--source include/not_valgrind.inc
--source include/linux.inc
--source include/big_test.inc
--source include/force_restart.inc
--source ../inc/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source ../inc/group_replication.inc
--echo
--echo ############################################################
--echo # 0. Error suppressions.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR.");
SET SESSION sql_log_bin= 1;
--echo
--echo ############################################################
--echo # 1. Suspend server 1 by sending a signal SIGSTOP to it.
--echo # This will make server 1 to not answer to "I am alive"
--echo # GCS messages and it will be expelled from the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Get server pid.
SET SESSION sql_log_bin= 0;
CREATE TABLE pid_table(pid_no INT);
--let $pid_file= `SELECT @@GLOBAL.pid_file`
--replace_result $pid_file pid_file
--eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
--let $server_pid=`SELECT pid_no FROM pid_table`
DROP TABLE pid_table;
SET SESSION sql_log_bin= 1;
--echo # Send signal SIGSTOP to server 1.
--exec kill -19 $server_pid
--echo
--echo ############################################################
--echo # 2. Wait until group expel server 1.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 2
--source ../inc/gr_wait_for_number_of_members.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 2
--source ../inc/gr_wait_for_number_of_members.inc
--echo
--echo ############################################################
--echo # 3. Resume server 1 by sending a signal SIGCONT to it.
--echo # Server will notice that was expelled from the group,
--echo # will change to ERROR state and enabled super_read_only
--echo # mode.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Send signal SIGCONT to server 1.
--exec kill -18 $server_pid
--let $group_replication_member_state= ERROR
--source ../inc/gr_wait_for_member_state.inc
--let $group_replication_number_of_members= 1
--source ../inc/gr_wait_for_number_of_members.inc
--let $wait_condition= SELECT @@GLOBAL.super_read_only = '1'
--source include/wait_condition.inc
--error ER_OPTION_PREVENTS_STATEMENT
CREATE TABLE te (c1 INT NOT NULL PRIMARY KEY);
--echo
--echo ############################################################
--echo # 4. Stop and start server 1, it will be back to normal.
--source include/stop_group_replication.inc
--source include/start_group_replication.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 5. Check data.
--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $diff_tables= server1:test.t1, server2:test.t1, server3:test.t1
--source include/diff_tables.inc
--echo
--echo ############################################################
--echo # 6. Clean up.
DROP TABLE t1;
--source ../inc/group_replication_end.inc
OHA YOOOO