Debian Codegraph @

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

raw
1 ###############################################################################
2 # Validate several scenarios on the UDF:
3 # asynchronous_connection_failover_reset
4 #
5 # Test:
6 # 0. This test requires two servers
7 # 1. Create a replication channel ch1 to replicate from
8 # server2 to server1.
9 # 2. Try to reset asynchronous reconnection configuration with
10 # invalid parameters.
11 # It will not be allowed.
12 # 3. Try to reset asynchronous reconnection configuration while
13 # channels are running.
14 # It will not be allowed.
15 # 4. Reset asynchronous reconnection configuration while
16 # channels are stopped.
17 # It will be allowed.
18 # 5. Reset asynchronous reconnection configuration while
19 # channels are stopped for managed source.
20 # It will be allowed.
21 # 6. Clean up.
22 ###############################################################################
23 --source include/have_slave_repository_type_table.inc
24 --let $rpl_skip_start_slave= 1
25 --source include/master-slave.inc
26
27 --echo
28 --echo ############################################################
29 --echo # 1. Create a replication channel ch1 to replicate from
30 --echo # server2 to server1.
31
32 --let $rpl_connection_name= slave
33 --source include/rpl_connection.inc
34
35 --replace_result $SERVER_MYPORT_1 SERVER_1_PORT
36 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=$SERVER_MYPORT_1, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1, SOURCE_CONNECTION_AUTO_FAILOVER=1 FOR CHANNEL 'ch1'
37 --let $rpl_channel_name='ch1'
38 --source include/start_slave.inc
39
40
41
42 --echo
43 --echo ############################################################
44 --echo # 2. Try to reset asynchronous reconnection configuration with
45 --echo # invalid parameters.
46 --echo # It will not be allowed.
47
48 --error ER_CANT_INITIALIZE_UDF
49 SELECT asynchronous_connection_failover_reset(1);
50
51
52 --error ER_CANT_INITIALIZE_UDF
53 SELECT asynchronous_connection_failover_reset("");
54
55
56 --echo
57 --echo ############################################################
58 --echo # 3. Try to reset asynchronous reconnection configuration while
59 --echo # channels are running.
60 --echo # It will not be allowed.
61 --error ER_CANT_INITIALIZE_UDF
62 SELECT asynchronous_connection_failover_reset();
63
64 --let $rpl_channel_name='ch1'
65 --source include/stop_slave_sql.inc
66
67 --let $assert_text= Verify replica_monitor thread is running
68 --let $assert_cond= "[select count(*) FROM performance_schema.threads where NAME=\"thread/sql/replica_monitor\"]" = 1;
69 --source include/assert.inc
70
71 --error ER_CANT_INITIALIZE_UDF
72 SELECT asynchronous_connection_failover_reset();
73
74
75 --echo
76 --echo ############################################################
77 --echo # 4. Reset asynchronous reconnection configuration while
78 --echo # channels are stopped.
79 --echo # It will be allowed.
80 --let $rpl_channel_name='ch1'
81 --source include/stop_slave_io.inc
82
83 --let $assert_text= Verify replica_monitor thread is not running
84 --let $assert_cond= "[select count(*) FROM performance_schema.threads where NAME=\"thread/sql/replica_monitor\"]" = 0;
85 --source include/assert.inc
86
87 SELECT asynchronous_connection_failover_reset();
88
89 # Add a source.
90 SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', 3100);
91
92 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
93 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
94 --source include/assert.inc
95
96 SELECT asynchronous_connection_failover_reset();
97
98 --let $assert_text= 'There are 0 rows in performance_schema.replication_asynchronous_connection_failover'
99 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
100 --source include/assert.inc
101
102
103 --echo
104 --echo ############################################################
105 --echo # 5. Reset asynchronous reconnection configuration while
106 --echo # channels are stopped for managed source.
107 --echo # It will be allowed.
108 # Add a managed source.
109 --let $uuid_val= `SELECT UUID()`
110 --replace_result $uuid_val UUID_VAL
111 --eval SELECT asynchronous_connection_failover_add_managed('ch1', 'GroupReplication', "$uuid_val", '127.0.0.1', 3100, '', 80, 60)
112
113 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover_managed'
114 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed, count, 1] = 1
115 --source include/assert.inc
116
117 --let $assert_text= 'There is one row in performance_schema.replication_asynchronous_connection_failover'
118 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 1
119 --source include/assert.inc
120
121
122 SELECT asynchronous_connection_failover_reset();
123
124 --let $assert_text= 'There are 0 rows in performance_schema.replication_asynchronous_connection_failover_managed'
125 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover_managed, count, 1] = 0
126 --source include/assert.inc
127
128 --let $assert_text= 'There are 0 rows in performance_schema.replication_asynchronous_connection_failover'
129 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 0
130 --source include/assert.inc
131
132
133 --echo
134 --echo ############################################################
135 --echo # 6. Clean up.
136 --let $rpl_channel_name='ch1'
137 --let $rpl_reset_slave_all= 1
138 --let $rpl_multi_source= 1
139 --source include/rpl_reset_slave.inc
140 --let $rpl_channel_name=
141 --let $rpl_reset_slave_all=
142 --let $rpl_multi_source=
143
144 --let $rpl_skip_sync = 1
145 --source include/rpl_end.inc