| 1 |
############################################################################### |
| 2 |
# Validate that member action `mysql_disable_super_read_only_if_primary` is |
| 3 |
# triggered on group bootstrap when enabled. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. This test requires two servers. |
| 7 |
# 1. Configure server2 to be a asynchronous replica of server1, |
| 8 |
# configuring a failover channel to server1. |
| 9 |
# 2. Bootstrap a group on server2. |
| 10 |
# Since `mysql_start_failover_channels_if_primary` member |
| 11 |
# action is enabled, channel 'ch1' will be started. |
| 12 |
# 3. Clean up. |
| 13 |
############################################################################### |
| 14 |
--source include/have_group_replication_plugin.inc |
| 15 |
--let $rpl_skip_group_replication_start= 1 |
| 16 |
--let $rpl_group_replication_single_primary_mode=1 |
| 17 |
--source include/group_replication.inc |
| 18 |
|
| 19 |
|
| 20 |
--echo ############################################################ |
| 21 |
--echo # 1. Configure server2 to be a asynchronous replica of server1, |
| 22 |
--echo # configuring a failover channel to server1. |
| 23 |
--let $rpl_connection_name= server1 |
| 24 |
--source include/rpl_connection.inc |
| 25 |
--let $server1_uuid= `SELECT @@server_uuid` |
| 26 |
|
| 27 |
--let $rpl_connection_name= server2 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 |
| 30 |
--eval SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', $SERVER_MYPORT_1, '', 50); |
| 31 |
|
| 32 |
--replace_result $SERVER_MYPORT_1 SERVER_1_PORT |
| 33 |
--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' |
| 34 |
|
| 35 |
|
| 36 |
--echo |
| 37 |
--echo ############################################################ |
| 38 |
--echo # 2. Bootstrap a group on server2. |
| 39 |
--echo # Since `mysql_start_failover_channels_if_primary` member |
| 40 |
--echo # action is enabled, channel 'ch1' will be started. |
| 41 |
--let $rpl_connection_name= server2 |
| 42 |
--source include/rpl_connection.inc |
| 43 |
|
| 44 |
--let $assert_text= The action mysql_start_failover_channels_if_primary must be enabled |
| 45 |
--let $assert_cond= [SELECT enabled FROM performance_schema.replication_group_member_actions WHERE name=\'mysql_start_failover_channels_if_primary\' AND event=\'AFTER_PRIMARY_ELECTION\', enabled, 1] = 1 |
| 46 |
--source include/assert.inc |
| 47 |
|
| 48 |
--source include/start_and_bootstrap_group_replication.inc |
| 49 |
--source include/gr_assert_primary_member.inc |
| 50 |
|
| 51 |
--let $rpl_channel_name= 'ch1' |
| 52 |
--source include/wait_for_slave_to_start.inc |
| 53 |
|
| 54 |
--let $assert_only_after = CURRENT_TEST: group_replication.gr_acf_start_failover_channels_on_bootstrap |
| 55 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 56 |
--let $assert_select= The member action "mysql_start_failover_channels_if_primary" for event "AFTER_PRIMARY_ELECTION" with priority "10" will be run. |
| 57 |
--let $assert_count= 1 |
| 58 |
--let $assert_text= The member action "mysql_start_failover_channels_if_primary" for event "AFTER_PRIMARY_ELECTION" with priority "10" will be run. |
| 59 |
--source include/assert_grep.inc |
| 60 |
|
| 61 |
--let $assert_text= 'SOURCE_CONNECTION_AUTO_FAILOVER must be enabled on ch1' |
| 62 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_configuration WHERE CHANNEL_NAME="ch1" AND SOURCE_CONNECTION_AUTO_FAILOVER=1, count, 1] = 1 |
| 63 |
--source include/assert.inc |
| 64 |
|
| 65 |
--let $assert_text= Verify channel ch1 IO_THREAD is ON |
| 66 |
--let $assert_cond= "[SELECT SERVICE_STATE FROM performance_schema.replication_connection_status WHERE channel_name=\'ch1\', SERVICE_STATE, 1]" = "ON" |
| 67 |
--source include/assert.inc |
| 68 |
|
| 69 |
--let $assert_text= Verify channel ch1 SQL_THREAD is ON |
| 70 |
--let $assert_cond= "[SELECT SERVICE_STATE FROM performance_schema.replication_applier_status WHERE channel_name=\'ch1\', SERVICE_STATE, 1]" = "ON" |
| 71 |
--source include/assert.inc |
| 72 |
|
| 73 |
--let $assert_text= Verify replica_monitor thread is running |
| 74 |
--let $assert_cond= "[select count(*) FROM performance_schema.threads where NAME=\"thread/sql/replica_monitor\"]" = 1; |
| 75 |
--source include/assert.inc |
| 76 |
|
| 77 |
|
| 78 |
--echo ############################################################ |
| 79 |
--echo # 3. Clean up. |
| 80 |
--let $rpl_connection_name= server2 |
| 81 |
--source include/rpl_connection.inc |
| 82 |
--source include/stop_group_replication.inc |
| 83 |
|
| 84 |
--let $rpl_channel_name= 'ch1' |
| 85 |
--let $rpl_reset_slave_all= 1 |
| 86 |
--let $rpl_multi_source= 1 |
| 87 |
--source include/rpl_reset_slave.inc |
| 88 |
--let $rpl_channel_name= |
| 89 |
--let $rpl_reset_slave_all= |
| 90 |
--let $rpl_multi_source= |
| 91 |
|
| 92 |
--source include/group_replication_end.inc |