Debian Codegraph @

mysql-test/suite/group_replication/t/gr_acf_receiver_group.test

raw
1 ################################################################################
2 # Validate that on STOP GROUP_REPLICATION existent asynchronous replication
3 # channels are stopped, including the Monitor IO thread if there are channels
4 # with SOURCE_CONNECTION_AUTO_FAILOVER=1.
5 #
6 # Test:
7 # 0. The test requires 2 servers:
8 # 1. Deploy a 1 member group A in single-primary mode.
9 # 2. Deploy a 1 member group B in single-primary mode.
10 # 3. Configure replica to manage the asynchronous connection
11 # between group A (source) and group B (replica).
12 # 4. Create and start the managed channel.
13 # 5. Stop group replication on group B
14 # Channel ch1, and the Monitor IO thread started by it,
15 # will automatically be stopped.
16 # 6. Clean up.
17 ################################################################################
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_skip_group_replication_start= 1
20 --source include/group_replication.inc
21
22
23 --echo
24 --echo ############################################################
25 --echo # 1. Deploy a 1 member group A in single-primary mode.
26 --let $rpl_connection_name= server1
27 --source include/rpl_connection.inc
28 --let $server1_uuid= `SELECT @@server_uuid`
29 --let $group_replication_group_name= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
30 --let $group_a= $group_replication_group_name
31 --source include/start_and_bootstrap_group_replication.inc
32
33
34 --echo
35 --echo ############################################################
36 --echo # 2. Deploy a 1 member group B in single-primary mode.
37 --let $rpl_connection_name= server2
38 --source include/rpl_connection.inc
39 --let $group_replication_group_name= bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
40 --source include/start_and_bootstrap_group_replication.inc
41
42
43 --echo
44 --echo ############################################################
45 --echo # 3. Configure replica to manage the asynchronous connection
46 --echo # between group A (source) and group B (replica).
47 --let $rpl_connection_name= server2
48 --source include/rpl_connection.inc
49
50 --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 $group_a GROUP_A
51 --eval SELECT asynchronous_connection_failover_add_managed('ch1', 'GroupReplication', '$group_a', '127.0.0.1', $SERVER_MYPORT_1, '', 90, 70);
52
53 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover for server1'
54 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE port=$SERVER_MYPORT_1, count, 1] = 1
55 --source include/assert.inc
56
57 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover_managed for group A'
58 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed WHERE managed_name="$group_a", count, 1] = 1
59 --source include/assert.inc
60
61
62 --echo
63 --echo ############################################################
64 --echo # 4. Create and start the managed channel.
65 --let $rpl_connection_name= server2
66 --source include/rpl_connection.inc
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=1 FOR CHANNEL 'ch1'
69
70 --let $rpl_channel_name='ch1'
71 --source include/start_slave.inc
72 --let $rpl_channel_name=
73
74 --let $assert_text= Verify channel ch1 IO_THREAD is ON and connected to server1
75 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="ch1" AND source_uuid="$server1_uuid" AND SERVICE_STATE="ON", count, 1] = 1
76 --source include/assert.inc
77
78 --let $assert_text= Verify replica_monitor thread is running
79 --let $assert_cond= "[SELECT COUNT(*) FROM performance_schema.threads WHERE NAME=\"thread/sql/replica_monitor\"]" = 1;
80 --source include/assert.inc
81
82
83 --echo
84 --echo ############################################################
85 --echo # 5. Stop group replication on group B
86 --echo # Channel ch1, and the Monitor IO thread started by it,
87 --echo # will automatically be stopped.
88 --let $rpl_connection_name= server2
89 --source include/rpl_connection.inc
90 --source include/stop_group_replication.inc
91
92 --let $assert_text= 'channel ch1 SQL_THREAD is OFF'
93 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_applier_status where CHANNEL_NAME="ch1" and SERVICE_STATE="OFF", count, 1] = 1
94 --source include/assert.inc
95
96 --let $assert_text= 'channel ch1 IO_THREAD is OFF'
97 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="ch1" and SERVICE_STATE="OFF", count, 1] = 1
98 --source include/assert.inc
99
100 --let $assert_text= 'replica_monitor thread is not running'
101 --let $assert_cond= "[SELECT COUNT(*) FROM performance_schema.threads WHERE NAME=\"thread/sql/replica_monitor\"]" = 0;
102 --source include/assert.inc
103
104
105 --echo
106 --echo ############################################################
107 --echo # 6. Clean up.
108 --echo
109 --let $rpl_connection_name= server2
110 --source include/rpl_connection.inc
111
112 --let $rpl_channel_name='ch1'
113 --let $rpl_reset_slave_all= 1
114 --let $rpl_multi_source= 1
115 --source include/rpl_reset_slave.inc
116 --let $rpl_channel_name=
117 --let $rpl_reset_slave_all=
118 --let $rpl_multi_source=
119
120 --replace_result $group_a GROUP_A
121 --eval SELECT asynchronous_connection_failover_delete_managed('ch1', '$group_a')
122
123 --let $rpl_connection_name= server1
124 --source include/rpl_connection.inc
125 --source include/stop_group_replication.inc
126
127 --source include/group_replication_end.inc