| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# WL#12649: Automatic reconnection for Async replication between InnoDB Clusters |
| 4 |
# |
| 5 |
# Checks for performance_schema.replication_asynchronous_connection_failover |
| 6 |
# table. |
| 7 |
# |
| 8 |
# ==== Implementation ==== |
| 9 |
# |
| 10 |
# 1. Add six rows in |
| 11 |
# performance_schema.replication_asynchronous_connection_failover table. |
| 12 |
# 2. Checks for performance_schema.replication_asynchronous_connection_failover |
| 13 |
# table. |
| 14 |
# 3. Cleanup |
| 15 |
# |
| 16 |
|
| 17 |
--let $rpl_skip_start_slave= 1 |
| 18 |
--source include/master-slave.inc |
| 19 |
|
| 20 |
--echo # |
| 21 |
--echo # 1. Add six rows in |
| 22 |
--echo # performance_schema.replication_asynchronous_connection_failover |
| 23 |
--echo # table. |
| 24 |
--echo # |
| 25 |
|
| 26 |
SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', 3101, 'net1'); |
| 27 |
SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', 3102, 'net2'); |
| 28 |
SELECT asynchronous_connection_failover_add_source('ch1', '192.168.0.1', 3101, 'net2', 40); |
| 29 |
|
| 30 |
SELECT asynchronous_connection_failover_add_source('ch2', '127.0.0.1', 3102); |
| 31 |
SELECT asynchronous_connection_failover_add_source('ch2', '127.0.0.1', 3103); |
| 32 |
SELECT asynchronous_connection_failover_add_source('ch2', '192.168.0.1', 3101, 'net1', 40); |
| 33 |
|
| 34 |
|
| 35 |
--echo # |
| 36 |
--echo # 2. Checks for |
| 37 |
--echo # performance_schema.replication_asynchronous_connection_failover |
| 38 |
--echo # table. |
| 39 |
--echo # |
| 40 |
|
| 41 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 42 |
# has no rows with channel_name="ch3". |
| 43 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has no rows with channel_name="ch3"' |
| 44 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch3", count, 1] = 0 |
| 45 |
--source include/assert.inc |
| 46 |
|
| 47 |
|
| 48 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 49 |
# has six rows. |
| 50 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has six rows' |
| 51 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover, count, 1] = 6 |
| 52 |
--source include/assert.inc |
| 53 |
|
| 54 |
|
| 55 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 56 |
# has three rows with channel_name="ch1". |
| 57 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has three rows with channel_name="ch1"' |
| 58 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1", count, 1] = 3 |
| 59 |
--source include/assert.inc |
| 60 |
|
| 61 |
|
| 62 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 63 |
# has two rows with channel_name="ch1" and host="127.0.0.1". |
| 64 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with channel_name="ch1" and host="127.0.0.1"' |
| 65 |
--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 |
| 66 |
--source include/assert.inc |
| 67 |
|
| 68 |
|
| 69 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 70 |
# has one row with channel_name="ch1" and host="127.0.0.1" and port=3101. |
| 71 |
--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' |
| 72 |
--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 |
| 73 |
--source include/assert.inc |
| 74 |
|
| 75 |
|
| 76 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 77 |
# has no rows with channel_name="ch1" and host="127.0.0.1" and port=3101 and |
| 78 |
# network_namespace="net0". |
| 79 |
--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"' |
| 80 |
--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 |
| 81 |
--source include/assert.inc |
| 82 |
|
| 83 |
|
| 84 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 85 |
# has one row with channel_name="ch1" and host="192.168.0.1" and port=3101. |
| 86 |
--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=""' |
| 87 |
--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 |
| 88 |
--source include/assert.inc |
| 89 |
|
| 90 |
|
| 91 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 92 |
# has two rows with channel_name="ch1" and port=3101'. |
| 93 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with channel_name="ch1" and port=3101' |
| 94 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where channel_name="ch1" and port=3101, count, 1] = 2 |
| 95 |
--source include/assert.inc |
| 96 |
|
| 97 |
|
| 98 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 99 |
# has two rows with host="192.168.0.1" and port=3101'. |
| 100 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with host="192.168.0.1" and port=3101' |
| 101 |
--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 |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
|
| 105 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 106 |
# has two rows with host="192.168.0.1". |
| 107 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with host="192.168.0.1"' |
| 108 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where host="192.168.0.1", count, 1] = 2 |
| 109 |
--source include/assert.inc |
| 110 |
|
| 111 |
|
| 112 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 113 |
# has three rows with port=3101. |
| 114 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has three rows with port=3101' |
| 115 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where port=3101, count, 1] = 3 |
| 116 |
--source include/assert.inc |
| 117 |
|
| 118 |
|
| 119 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 120 |
# has zero rows with network_namespace="net2", as network_namespace field is |
| 121 |
# in replication_asynchronous_connection_failover is added as empty value |
| 122 |
# through asynchronous_connection_failover_add_source UDF. |
| 123 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with network_namespace="net2"' |
| 124 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where network_namespace="net2", count, 1] = 0 |
| 125 |
--source include/assert.inc |
| 126 |
|
| 127 |
|
| 128 |
# Check performance_schema.replication_asynchronous_connection_failover table |
| 129 |
# has two rows with weight=40'. |
| 130 |
--let $assert_text= 'The performance_schema.replication_asynchronous_connection_failover table has two rows with weight=40' |
| 131 |
--let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover where weight=40, count, 1] = 2 |
| 132 |
--source include/assert.inc |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
--echo # |
| 137 |
--echo # 3. Cleanup |
| 138 |
--echo # |
| 139 |
|
| 140 |
SELECT asynchronous_connection_failover_delete_source('ch1', '127.0.0.1', 3101, 'net1'); |
| 141 |
SELECT asynchronous_connection_failover_delete_source('ch1', '127.0.0.1', 3102, 'net2'); |
| 142 |
SELECT asynchronous_connection_failover_delete_source('ch1', '192.168.0.1', 3101, 'net2'); |
| 143 |
|
| 144 |
SELECT asynchronous_connection_failover_delete_source('ch2', '127.0.0.1', 3102); |
| 145 |
SELECT asynchronous_connection_failover_delete_source('ch2', '127.0.0.1', 3103); |
| 146 |
SELECT asynchronous_connection_failover_delete_source('ch2', '192.168.0.1', 3101, 'net1'); |
| 147 |
|
| 148 |
--let $rpl_only_running_threads= 1 |
| 149 |
--source include/rpl_end.inc |