| 1 |
############################################################################### |
| 2 |
# Validate several scenarios on the UDF: |
| 3 |
# asynchronous_connection_failover_reset |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. This test requires three servers |
| 7 |
# server1: group primary |
| 8 |
# server2: group secondary |
| 9 |
# server3: standalone server |
| 10 |
# |
| 11 |
# 1. Try to reset asynchronous reconnection configuration on |
| 12 |
# a server running GR. |
| 13 |
# It will not be allowed. |
| 14 |
# 2. Try to reset asynchronous reconnection configuration on |
| 15 |
# a server not running GR. |
| 16 |
# It will be allowed. |
| 17 |
# 3. Clean up |
| 18 |
############################################################################### |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--let $rpl_skip_group_replication_start= 1 |
| 21 |
--let $rpl_group_replication_single_primary_mode=1 |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo |
| 25 |
--echo ############################################################ |
| 26 |
--echo # 1. Try to reset asynchronous reconnection configuration on |
| 27 |
--echo # a server running GR. |
| 28 |
--echo # It will not be allowed. |
| 29 |
--let $rpl_connection_name= server1 |
| 30 |
--source include/rpl_connection.inc |
| 31 |
--source include/start_and_bootstrap_group_replication.inc |
| 32 |
|
| 33 |
--error ER_CANT_INITIALIZE_UDF |
| 34 |
SELECT asynchronous_connection_failover_reset(); |
| 35 |
|
| 36 |
|
| 37 |
--echo |
| 38 |
--echo ############################################################ |
| 39 |
--echo # 2. Try to reset asynchronous reconnection configuration on |
| 40 |
--echo # a server not running GR. |
| 41 |
--echo # It will be allowed. |
| 42 |
--let $rpl_connection_name= server2 |
| 43 |
--source include/rpl_connection.inc |
| 44 |
--source include/start_group_replication.inc |
| 45 |
|
| 46 |
--let $rpl_connection_name= server3 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $group_replication_group_name FAILOVER_GROUP_NAME |
| 49 |
--eval SELECT asynchronous_connection_failover_add_managed('ch1_3', 'GroupReplication', '$group_replication_group_name', '127.0.0.1', $SERVER_MYPORT_2, '', 80, 60) |
| 50 |
|
| 51 |
--let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover_managed' |
| 52 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed, count, 1] = 1 |
| 53 |
--source include/assert.inc |
| 54 |
|
| 55 |
--let $assert_text= 'The version of replication_asynchronous_connection_failover_managed must be 1' |
| 56 |
--let $assert_cond= [SELECT version FROM performance_schema.replication_group_configuration_version WHERE name=\'replication_asynchronous_connection_failover_managed\', version, 1] = 1 |
| 57 |
--source include/assert.inc |
| 58 |
|
| 59 |
--let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover' |
| 60 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1 |
| 61 |
--source include/assert.inc |
| 62 |
|
| 63 |
--let $assert_text= 'The version of replication_asynchronous_connection_failover must be 1' |
| 64 |
--let $assert_cond= [SELECT version FROM performance_schema.replication_group_configuration_version WHERE name=\'replication_asynchronous_connection_failover\', version, 1] = 1 |
| 65 |
--source include/assert.inc |
| 66 |
|
| 67 |
--replace_result $SERVER_MYPORT_1 SERVER_1_PORT |
| 68 |
--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=2 FOR CHANNEL 'ch1_3' |
| 69 |
|
| 70 |
--let $rpl_channel_name='ch1_3' |
| 71 |
--source include/start_slave.inc |
| 72 |
--let $rpl_channel_name= |
| 73 |
|
| 74 |
--let $wait_condition= SELECT COUNT(*)=2 FROM performance_schema.replication_asynchronous_connection_failover |
| 75 |
--source include/wait_condition.inc |
| 76 |
|
| 77 |
--let $assert_text= 'The version of replication_asynchronous_connection_failover must be 2 or greater' |
| 78 |
--let $assert_cond= [SELECT version FROM performance_schema.replication_group_configuration_version WHERE name=\'replication_asynchronous_connection_failover\', version, 1] >= 2 |
| 79 |
--source include/assert.inc |
| 80 |
|
| 81 |
--let $rpl_channel_name='ch1_3' |
| 82 |
--source include/stop_slave.inc |
| 83 |
--let $rpl_channel_name= |
| 84 |
|
| 85 |
# Reset asynchronous reconnection configuration |
| 86 |
SELECT asynchronous_connection_failover_reset(); |
| 87 |
|
| 88 |
--let $assert_text= 'There is no row in performance_schema.replication_asynchronous_connection_failover_managed' |
| 89 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed, count, 1] = 0 |
| 90 |
--source include/assert.inc |
| 91 |
|
| 92 |
--let $assert_text= 'There is no version of replication_asynchronous_connection_failover_managed' |
| 93 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_group_configuration_version WHERE name=\'replication_asynchronous_connection_failover_managed\', count, 1] = 0 |
| 94 |
--source include/assert.inc |
| 95 |
|
| 96 |
--let $assert_text= 'There is no row in performance_schema.replication_asynchronous_connection_failover' |
| 97 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0 |
| 98 |
--source include/assert.inc |
| 99 |
|
| 100 |
--let $assert_text= 'There is no version of replication_asynchronous_connection_failover' |
| 101 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_group_configuration_version WHERE name=\'replication_asynchronous_connection_failover\', count, 1] = 0 |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
|
| 105 |
--echo |
| 106 |
--echo ############################################################ |
| 107 |
--echo # 3. Clean up. |
| 108 |
--let $rpl_connection_name= server3 |
| 109 |
--source include/rpl_connection.inc |
| 110 |
|
| 111 |
--let $rpl_reset_slave_all= 1 |
| 112 |
--let $rpl_multi_source= 1 |
| 113 |
--let $rpl_channel_name='ch1_3' |
| 114 |
--source include/rpl_reset_slave.inc |
| 115 |
--let $rpl_channel_name= |
| 116 |
--let $rpl_reset_slave_all= |
| 117 |
--let $rpl_multi_source= |
| 118 |
|
| 119 |
--let $rpl_skip_sync= 1 |
| 120 |
--let $rpl_only_running_threads= 1 |
| 121 |
--source include/group_replication_end.inc |