File: rpl_async_conn_failover_perfschema.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (149 lines) | stat: -rw-r--r-- 8,209 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# ==== Purpose ====
#
# WL#12649: Automatic reconnection for Async replication between InnoDB Clusters
#
# Checks for performance_schema.replication_asynchronous_connection_failover
# table.
#
# ==== Implementation ====
#
# 1. Add six rows in
#    performance_schema.replication_asynchronous_connection_failover table.
# 2. Checks for performance_schema.replication_asynchronous_connection_failover
#    table.
# 3. Cleanup
#

--let $rpl_skip_start_slave= 1
--source include/master-slave.inc

--echo #
--echo # 1. Add six rows in
--echo #    performance_schema.replication_asynchronous_connection_failover
--echo #    table.
--echo #

SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', 3101, 'net1');
SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', 3102, 'net2');
SELECT asynchronous_connection_failover_add_source('ch1', '192.168.0.1', 3101, 'net2', 40);

SELECT asynchronous_connection_failover_add_source('ch2', '127.0.0.1', 3102);
SELECT asynchronous_connection_failover_add_source('ch2', '127.0.0.1', 3103);
SELECT asynchronous_connection_failover_add_source('ch2', '192.168.0.1', 3101, 'net1', 40);


--echo #
--echo # 2. Checks for
--echo #    performance_schema.replication_asynchronous_connection_failover
--echo #    table.
--echo #

# Check performance_schema.replication_asynchronous_connection_failover table
# has no rows with channel_name="ch3".
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has no rows with channel_name="ch3"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch3", count, 1] = 0
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has six rows.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has six rows'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 6
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has three rows with channel_name="ch1".
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has three rows with channel_name="ch1"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1", count, 1] = 3
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has two rows with channel_name="ch1" and host="127.0.0.1".
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with channel_name="ch1" and host="127.0.0.1"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and host="127.0.0.1", count, 1] = 2
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has one row with channel_name="ch1" and host="127.0.0.1" and port=3101.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has one row with channel_name="ch1" and host="127.0.0.1" and port=3101'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and host="127.0.0.1" and port=3101, count, 1] = 1
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has no rows with channel_name="ch1" and host="127.0.0.1" and port=3101 and
# network_namespace="net0".
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has no rows with channel_name="ch1" and host="127.0.0.1" and port=3101 and network_namespace="net0"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and host="127.0.0.1" and port=3101 and network_namespace="net0", count, 1] = 0
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has one row with channel_name="ch1" and host="192.168.0.1" and port=3101.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has one row with channel_name="ch1" and host="192.168.0.1" and port=3101 and network_namespace=""'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and host="192.168.0.1" and port=3101 and network_namespace="", count, 1] = 1
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has two rows with channel_name="ch1" and port=3101'.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with channel_name="ch1" and port=3101'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and port=3101, count, 1] = 2
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has two rows with host="192.168.0.1" and port=3101'.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with host="192.168.0.1" and port=3101'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where host="192.168.0.1" and port=3101, count, 1] = 2
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has two rows with host="192.168.0.1".
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with host="192.168.0.1"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where host="192.168.0.1", count, 1] = 2
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has three rows with port=3101.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has three rows with port=3101'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where port=3101, count, 1] = 3
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has zero rows with network_namespace="net2", as network_namespace field is
# in replication_asynchronous_connection_failover is added as empty value
# through asynchronous_connection_failover_add_source UDF.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with network_namespace="net2"'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where network_namespace="net2", count, 1] = 0
--source include/assert.inc


# Check performance_schema.replication_asynchronous_connection_failover table
# has two rows with weight=40'.
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with weight=40'
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where weight=40, count, 1] = 2
--source include/assert.inc



--echo #
--echo # 3. Cleanup
--echo #

SELECT asynchronous_connection_failover_delete_source('ch1', '127.0.0.1', 3101, 'net1');
SELECT asynchronous_connection_failover_delete_source('ch1', '127.0.0.1', 3102, 'net2');
SELECT asynchronous_connection_failover_delete_source('ch1', '192.168.0.1', 3101, 'net2');

SELECT asynchronous_connection_failover_delete_source('ch2', '127.0.0.1', 3102);
SELECT asynchronous_connection_failover_delete_source('ch2', '127.0.0.1', 3103);
SELECT asynchronous_connection_failover_delete_source('ch2', '192.168.0.1', 3101, 'net1');

--let $rpl_only_running_threads= 1
--source include/rpl_end.inc