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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
###############################################################################
#
# Any member exit or failure under a majority shall not affect
# the process of changing to multi master mode.
#
# Test:
# 0. This test require 3 servers
# 1. Server1 start, bootstrap the group and create table test.t1
# 2. Start server2 and server3
# 3. Begin a transaction on server1
# 4. Execute action to switch to multi primary
# 5. Assert that action is waiting for a member
# 6. Restart a member, won't impact the success of action
# 7. COMMIT pending transaction to action switch to multi primary be
# executed
# 8. Confirm that exists two members as primary in the group
# 9. Cleanup
#
###############################################################################
--source include/have_group_replication_plugin.inc
--source include/not_valgrind.inc
--let $rpl_server_count= 3
--let $rpl_skip_group_replication_start= 1
--let $rpl_group_replication_single_primary_mode=1
--source include/group_replication.inc
--echo
--echo # 1. Server1 start, bootstrap the group and create table test.t1
--source include/start_and_bootstrap_group_replication.inc
CREATE TABLE test.t1 (a INT PRIMARY KEY);
--echo
--echo # 2. Start server2 and server3
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo # 3. Begin a transaction on server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
BEGIN;
INSERT INTO t1 VALUES(1);
--echo
--echo # 4. Execute action to switch to multi primary
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--send SELECT group_replication_switch_to_multi_primary_mode()
--echo
--echo # 5. Assert that action is waiting for a member
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%waiting on another member step%"
--source include/wait_condition.inc
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";`
--let $assert_text= stage/group_rpl/Multi-primary Switch: waiting on another member step completion
--let $assert_cond= "$stage_name" = "stage/group_rpl/Multi-primary Switch: waiting on another member step completion"
--source include/assert.inc
--echo
--echo # 6. Restart a member, won't impact the success of action
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $restart_parameters=restart:--group_replication_local_address=$group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name
--replace_result $group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--source include/kill_and_restart_mysqld.inc
--let $rpl_server_number= 3
--source include/rpl_reconnect.inc
--echo
--echo # 7. COMMIT pending transaction to action switch to multi primary be
--echo # executed
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
COMMIT;
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--reap
--echo
--echo # 8. Confirm that exists two members as primary in the group
--source include/gr_assert_multi_primary_mode.inc
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/gr_assert_multi_primary_mode.inc
--echo
--echo # 9. Cleanup
DROP TABLE t1;
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
DROP TABLE t1;
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $rpl_group_replication_reset_persistent_vars=1
--source include/group_replication_end.inc
|