Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_async_conn_failover_stop.test

raw
1 ##############################################################################
2 # Validate that when a channel with SOURCE_CONNECTION_AUTO_FAILOVER=1 is stopped
3 # after the channel IO Thread stopped due to a error, the Monitor IO thread is
4 # also stopped.
5 #
6 # Test:
7 # 0. The test requires two servers: S1 and S2.
8 # 1. Enable Asynchronous Replication Connection Failover but
9 # do not add failover sources.
10 # 2. Stop source server, replica IO thread will fail.
11 # Despite connection failover is enabled, since there are
12 # no failover sources the IO thread will stop.
13 # 3. Stop replica.
14 # 4. Clean up.
15 ################################################################################
16 --let $use_gtids= 1
17 --source include/master-slave.inc
18
19
20 --echo
21 --echo ############################################################
22 --echo # 1. Enable Asynchronous Replication Connection Failover but
23 --echo # do not add failover sources.
24 --source include/rpl_connection_slave.inc
25 --source include/stop_slave.inc
26 CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1, SOURCE_CONNECTION_AUTO_FAILOVER=1;
27 --source include/start_slave.inc
28
29 --let $assert_text= 'Asynchronous Replication Connection Failover is enabled'
30 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_connection_configuration WHERE SOURCE_CONNECTION_AUTO_FAILOVER=1, count, 1] = 1
31 --source include/assert.inc
32
33 --let $assert_text= 'There are no rows in performance_schema.replication_asynchronous_connection_failover'
34 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
35 --source include/assert.inc
36
37 --let $assert_text= 'Verify replica_monitor thread is running'
38 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.threads WHERE NAME=\"thread/sql/replica_monitor\", count, 1] = 1
39 --source include/assert.inc
40
41
42 --echo
43 --echo ############################################################
44 --echo # 2. Stop source server, replica IO thread will fail.
45 --echo # Despite connection failover is enabled, since there are
46 --echo # no failover sources the IO thread will stop.
47 --source include/rpl_connection_master.inc
48 --let $rpl_server_number= 1
49 --source include/rpl_stop_server.inc
50
51 --source include/rpl_connection_slave.inc
52 --let $slave_io_errno= 2003
53 --source include/wait_for_slave_io_error.inc
54
55 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE SERVICE_STATE="OFF"
56 --source include/wait_condition.inc
57
58 --let $assert_text= 'Verify replica_monitor thread is running'
59 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.threads WHERE NAME=\"thread/sql/replica_monitor\", count, 1] = 1
60 --source include/assert.inc
61
62
63 --echo
64 --echo ############################################################
65 --echo # 3. Stop replica.
66 --source include/rpl_connection_slave.inc
67 --source include/stop_slave.inc
68
69 --let $assert_text= 'Verify replica_monitor thread is not running'
70 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.threads WHERE NAME=\"thread/sql/replica_monitor\", count, 1] = 0
71 --source include/assert.inc
72
73
74 --echo
75 --echo ############################################################
76 --echo # 4. Clean up
77 --source include/rpl_connection_master.inc
78 --let $rpl_server_number= 1
79 --source include/rpl_start_server.inc
80
81 --source include/rpl_connection_slave.inc
82 --let $rpl_reset_slave_all= 1
83 --source include/rpl_reset_slave.inc
84 --let $rpl_reset_slave_all=
85
86 --let $rpl_skip_sync= 1
87 --let $rpl_only_running_threads= 1
88 --source include/rpl_end.inc