| 1 |
################################################################################ |
| 2 |
# Validate that the replication asynchronous connection failover feature cannot |
| 3 |
# be disabled on running channels. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires 4 servers: |
| 7 |
# server1: group primary |
| 8 |
# server2: group secondary |
| 9 |
# server3: replica server |
| 10 |
# 1. Deploy a 2 members group in single primary mode. |
| 11 |
# 2. Configure replica to manage the asynchronous connection |
| 12 |
# to group. |
| 13 |
# 3. Try disable the SOURCE_CONNECTION_AUTO_FAILOVER option |
| 14 |
# without stopping the channel. |
| 15 |
# 4. Clean up. |
| 16 |
################################################################################ |
| 17 |
--source include/big_test.inc |
| 18 |
--source include/have_group_replication_plugin.inc |
| 19 |
--let $rpl_skip_group_replication_start= 1 |
| 20 |
--let $rpl_server_count= 3 |
| 21 |
--source include/group_replication.inc |
| 22 |
|
| 23 |
|
| 24 |
--echo |
| 25 |
--echo ############################################################ |
| 26 |
--echo # 1. Deploy a 2 members group in single primary mode. |
| 27 |
--let $rpl_connection_name= server1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
--let $server1_uuid= `SELECT @@server_uuid` |
| 30 |
--source include/start_and_bootstrap_group_replication.inc |
| 31 |
|
| 32 |
--let $rpl_connection_name= server2 |
| 33 |
--source include/rpl_connection.inc |
| 34 |
--source include/start_group_replication.inc |
| 35 |
|
| 36 |
|
| 37 |
--echo |
| 38 |
--echo ############################################################ |
| 39 |
--echo # 2. Configure replica to manage the asynchronous connection |
| 40 |
--echo # to group. |
| 41 |
--let $rpl_connection_name= server3 |
| 42 |
--source include/rpl_connection.inc |
| 43 |
|
| 44 |
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 $group_replication_group_name GROUP_NAME |
| 45 |
--eval SELECT asynchronous_connection_failover_add_managed('ch1', 'GroupReplication', '$group_replication_group_name', '127.0.0.1', $SERVER_MYPORT_1, '', 90, 70) |
| 46 |
|
| 47 |
--let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover for server1' |
| 48 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE port=$SERVER_MYPORT_1, count, 1] = 1 |
| 49 |
--source include/assert.inc |
| 50 |
|
| 51 |
--let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover_managed for server1' |
| 52 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed WHERE managed_name="$group_replication_group_name", count, 1] = 1 |
| 53 |
--source include/assert.inc |
| 54 |
|
| 55 |
|
| 56 |
--echo |
| 57 |
--echo ############################################################ |
| 58 |
--echo # 2. Create and start the managed channel. |
| 59 |
--let $rpl_connection_name= server3 |
| 60 |
--source include/rpl_connection.inc |
| 61 |
--replace_result $SERVER_MYPORT_1 SERVER_1_PORT |
| 62 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_CONNECTION_AUTO_FAILOVER=1, SOURCE_PORT=$SERVER_MYPORT_1, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1 FOR CHANNEL 'ch1' |
| 63 |
|
| 64 |
--let $rpl_channel_name='ch1' |
| 65 |
--source include/start_slave.inc |
| 66 |
--let $rpl_channel_name= |
| 67 |
|
| 68 |
--let $assert_text= Verify channel ch1 IO_THREAD is ON and connected to server1 |
| 69 |
--let $assert_cond= "[SELECT SERVICE_STATE FROM performance_schema.replication_connection_status WHERE channel_name=\'ch1\' AND source_uuid=\'$server1_uuid\', SERVICE_STATE, 1]" = "ON" |
| 70 |
--source include/assert.inc |
| 71 |
|
| 72 |
--let $wait_condition= SELECT COUNT(*)=2 FROM performance_schema.replication_asynchronous_connection_failover |
| 73 |
--source include/wait_condition.inc |
| 74 |
|
| 75 |
|
| 76 |
--echo |
| 77 |
--echo ############################################################ |
| 78 |
--echo # 3. Try disable the SOURCE_CONNECTION_AUTO_FAILOVER option |
| 79 |
--echo # without stopping the channel. |
| 80 |
--let $rpl_connection_name= server3 |
| 81 |
--source include/rpl_connection.inc |
| 82 |
--error ER_REPLICA_CHANNEL_MUST_STOP |
| 83 |
CHANGE REPLICATION SOURCE TO SOURCE_CONNECTION_AUTO_FAILOVER=0 FOR CHANNEL 'ch1'; |
| 84 |
|
| 85 |
--let $assert_text= Verify replica_monitor thread is running |
| 86 |
--let $assert_cond= "[select count(*) FROM performance_schema.threads where NAME=\"thread/sql/replica_monitor\"]" = 1; |
| 87 |
--source include/assert.inc |
| 88 |
|
| 89 |
|
| 90 |
--echo |
| 91 |
--echo ############################################################ |
| 92 |
--echo # 4. Clean up. |
| 93 |
--let $rpl_connection_name= server3 |
| 94 |
--source include/rpl_connection.inc |
| 95 |
--let $rpl_channel_name='ch1' |
| 96 |
--source include/stop_slave.inc |
| 97 |
|
| 98 |
--let $rpl_reset_slave_all= 1 |
| 99 |
--let $rpl_multi_source= 1 |
| 100 |
--source include/rpl_reset_slave.inc |
| 101 |
--let $rpl_channel_name= |
| 102 |
--let $rpl_reset_slave_all= |
| 103 |
--let $rpl_multi_source= |
| 104 |
|
| 105 |
--replace_result $group_replication_group_name GROUP_NAME |
| 106 |
--eval SELECT asynchronous_connection_failover_delete_managed('ch1', '$group_replication_group_name') |
| 107 |
|
| 108 |
--let $assert_text= 'There are no rows in performance_schema.replication_asynchronous_connection_failover' |
| 109 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0 |
| 110 |
--source include/assert.inc |
| 111 |
|
| 112 |
--let $assert_text= 'There are no rows in performance_schema.replication_asynchronous_connection_failover_managed' |
| 113 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed, count, 1] = 0 |
| 114 |
--source include/assert.inc |
| 115 |
|
| 116 |
--let $rpl_connection_name= server2 |
| 117 |
--source include/rpl_connection.inc |
| 118 |
--source include/stop_group_replication.inc |
| 119 |
|
| 120 |
--let $rpl_connection_name= server1 |
| 121 |
--source include/rpl_connection.inc |
| 122 |
--source include/stop_group_replication.inc |
| 123 |
|
| 124 |
--source include/group_replication_end.inc |