| 1 |
############################################################################## |
| 2 |
# |
| 3 |
# All actions shall allow the DBA to check its progress. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. This test starts in multi primary mode with 2 servers. |
| 7 |
# |
| 8 |
# Phase 1: Changes to single primary mode |
| 9 |
# 1.1 Block the action on validation with a debug point |
| 10 |
# Change to single primary mode appoint server 2 as the new primary |
| 11 |
# Check the action is stuck in the check pre conditions stage |
| 12 |
# 1.2 Pause transactions on the new primary and execute a transaction on server1 |
| 13 |
# Unblock the debug point |
| 14 |
# Check the action is stuck in the Primary Election stage |
| 15 |
# 1.3 Block the stop process of the action using a debug point |
| 16 |
# Resume transactions on the new primary |
| 17 |
# Check it is stuck in the wait for other member to finish stage |
| 18 |
# 1.4 Unblock the debug point |
| 19 |
# Check the action terminates and no stages appear |
| 20 |
# |
| 21 |
# Phase 2: Changes to another primary |
| 22 |
# 2.1 Block the action on validation with a debug point |
| 23 |
# Change the current primary to server 1 |
| 24 |
# Check the action is stuck in the check pre conditions stage |
| 25 |
# 2.2 Start some transaction on the old primary (server2) |
| 26 |
# Unblock the debug point |
| 27 |
# Check the action is stuck waiting for old transactions to finish |
| 28 |
# Commit a transaction and see there is reported progress |
| 29 |
# 2.3 Lock a table t1 and execute a transaction on server2. |
| 30 |
# This will block the read mode during election |
| 31 |
# Commit the last transaction blocking phase 2.2 (table 2) |
| 32 |
# Check the action is stuck in the Primary Election stage |
| 33 |
# 2.4 Block the stop process of the action using a debug point |
| 34 |
# Unlock the table on the old primary (server2) |
| 35 |
# Check it is stuck in the wait for other member to finish stage |
| 36 |
# 2.5 Unblock the debug point |
| 37 |
# Check the action terminates and no stages appear |
| 38 |
# |
| 39 |
# 3.Cleanup |
| 40 |
############################################################################## |
| 41 |
|
| 42 |
--source include/big_test.inc |
| 43 |
--source include/have_debug_sync.inc |
| 44 |
--source include/have_group_replication_plugin.inc |
| 45 |
--source include/group_replication.inc |
| 46 |
|
| 47 |
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 48 |
|
| 49 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 50 |
--source include/rpl_sync.inc |
| 51 |
|
| 52 |
--let $rpl_connection_name= server2 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
|
| 55 |
--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 56 |
|
| 57 |
--echo |
| 58 |
--echo # 1.1 Block the action on validation with a debug point |
| 59 |
--echo # Change to single primary mode appoint server 2 as the new primary |
| 60 |
--echo # Check the action is stuck in the check pre conditions stage |
| 61 |
|
| 62 |
--let $rpl_connection_name= server1 |
| 63 |
--source include/rpl_connection.inc |
| 64 |
|
| 65 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 66 |
|
| 67 |
--replace_result $server2_uuid MEMBER2_UUID |
| 68 |
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server2_uuid") |
| 69 |
|
| 70 |
--let $rpl_connection_name= server_1 |
| 71 |
--source include/rpl_connection.inc |
| 72 |
|
| 73 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 74 |
--source include/wait_condition.inc |
| 75 |
|
| 76 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 77 |
--let $assert_text= The stage should be "Single-primary Switch: checking group pre-conditions" |
| 78 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: checking group pre-conditions" |
| 79 |
--source include/assert.inc |
| 80 |
|
| 81 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 82 |
--let $assert_text= The estimated work is 1 |
| 83 |
--let $assert_cond= "$work_estimated" = "1" |
| 84 |
--source include/assert.inc |
| 85 |
|
| 86 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 87 |
--let $assert_text= The completed work is 0 |
| 88 |
--let $assert_cond= "$work_completed" = "0" |
| 89 |
--source include/assert.inc |
| 90 |
|
| 91 |
--let $rpl_connection_name= server_2 |
| 92 |
--source include/rpl_connection.inc |
| 93 |
|
| 94 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" and work_completed=1 |
| 95 |
--source include/wait_condition.inc |
| 96 |
|
| 97 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 98 |
--let $assert_text= The stage should be "Single-primary Switch: checking group pre-conditions" |
| 99 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: checking group pre-conditions" |
| 100 |
--source include/assert.inc |
| 101 |
|
| 102 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 103 |
--let $assert_text= The estimated work is 1 |
| 104 |
--let $assert_cond= "$work_estimated" = "1" |
| 105 |
--source include/assert.inc |
| 106 |
|
| 107 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 108 |
--let $assert_text= The completed work is 1 |
| 109 |
--let $assert_cond= "$work_completed" = "1" |
| 110 |
--source include/assert.inc |
| 111 |
|
| 112 |
--echo |
| 113 |
--echo # 1.2 Pause transactions on the new primary and execute a transaction on server1 |
| 114 |
--echo # Unblock the debug point |
| 115 |
--echo # Check the action is stuck in the Primary Election stage |
| 116 |
|
| 117 |
--let $rpl_connection_name= server_2 |
| 118 |
--source include/rpl_connection.inc |
| 119 |
|
| 120 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_observer_trans'; |
| 121 |
|
| 122 |
--let $rpl_connection_name= server_1 |
| 123 |
--source include/rpl_connection.inc |
| 124 |
|
| 125 |
INSERT INTO t1 VALUES (1); |
| 126 |
|
| 127 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 128 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 129 |
|
| 130 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: executing Primary%" and work_completed=1 |
| 131 |
--source include/wait_condition.inc |
| 132 |
|
| 133 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 134 |
--let $assert_text= The stage should be "Single-primary Switch: executing Primary election" |
| 135 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: executing Primary election" |
| 136 |
--source include/assert.inc |
| 137 |
|
| 138 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 139 |
--let $assert_text= The estimated work is 2 |
| 140 |
--let $assert_cond= "$work_estimated" = "2" |
| 141 |
--source include/assert.inc |
| 142 |
|
| 143 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 144 |
--let $assert_text= The completed work is 1 |
| 145 |
--let $assert_cond= "$work_completed" = "1" |
| 146 |
--source include/assert.inc |
| 147 |
|
| 148 |
--let $rpl_connection_name= server2 |
| 149 |
--source include/rpl_connection.inc |
| 150 |
|
| 151 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_wait_on_observer_trans_waiting"; |
| 152 |
|
| 153 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: executing Primary%" and work_completed=1 |
| 154 |
--source include/wait_condition.inc |
| 155 |
|
| 156 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 157 |
--let $assert_text= The stage should be "Single-primary Switch: executing Primary election" |
| 158 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: executing Primary election" |
| 159 |
--source include/assert.inc |
| 160 |
|
| 161 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 162 |
--let $assert_text= The estimated work is 2 |
| 163 |
--let $assert_cond= "$work_estimated" = "2" |
| 164 |
--source include/assert.inc |
| 165 |
|
| 166 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 167 |
--let $assert_text= The completed work is 1 |
| 168 |
--let $assert_cond= "$work_completed" = "1" |
| 169 |
--source include/assert.inc |
| 170 |
|
| 171 |
--echo |
| 172 |
--echo # 1.3 Block the stop process of the action using a debug point |
| 173 |
--echo # Resume transactions on the new primary |
| 174 |
--echo # Check it is stuck in the wait for other member to finish stage |
| 175 |
|
| 176 |
--let $rpl_connection_name= server_2 |
| 177 |
--source include/rpl_connection.inc |
| 178 |
|
| 179 |
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_observer_trans'; |
| 180 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 181 |
SET DEBUG_SYNC= 'now SIGNAL signal.group_replication_wait_on_observer_trans_continue'; |
| 182 |
|
| 183 |
--source include/rpl_sync.inc |
| 184 |
|
| 185 |
--let $rpl_connection_name= server_1 |
| 186 |
--source include/rpl_connection.inc |
| 187 |
|
| 188 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for%" and work_completed=1 |
| 189 |
--source include/wait_condition.inc |
| 190 |
|
| 191 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 192 |
--let $assert_text= The stage should be "Single-primary Switch: waiting for operation to complete on all members" |
| 193 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: waiting for operation to complete on all members" |
| 194 |
--source include/assert.inc |
| 195 |
|
| 196 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 197 |
--let $assert_text= The estimated work is 2 |
| 198 |
--let $assert_cond= "$work_estimated" = "2" |
| 199 |
--source include/assert.inc |
| 200 |
|
| 201 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 202 |
--let $assert_text= The completed work is 1 |
| 203 |
--let $assert_cond= "$work_completed" = "1" |
| 204 |
--source include/assert.inc |
| 205 |
|
| 206 |
--let $rpl_connection_name= server2 |
| 207 |
--source include/rpl_connection.inc |
| 208 |
|
| 209 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for%" and work_completed=1 |
| 210 |
--source include/wait_condition.inc |
| 211 |
|
| 212 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 213 |
--let $assert_text= The stage should be "Single-primary Switch: waiting for operation to complete on all members" |
| 214 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Single-primary Switch: waiting for operation to complete on all members" |
| 215 |
--source include/assert.inc |
| 216 |
|
| 217 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 218 |
--let $assert_text= The estimated work is 2 |
| 219 |
--let $assert_cond= "$work_estimated" = "2" |
| 220 |
--source include/assert.inc |
| 221 |
|
| 222 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch:%";` |
| 223 |
--let $assert_text= The completed work is 1 |
| 224 |
--let $assert_cond= "$work_completed" = "1" |
| 225 |
--source include/assert.inc |
| 226 |
|
| 227 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 228 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 229 |
|
| 230 |
--echo |
| 231 |
--echo # 1.4 Unblock the debug point |
| 232 |
--echo # Check the action terminates and no stages appear |
| 233 |
|
| 234 |
--let $rpl_connection_name= server1 |
| 235 |
--source include/rpl_connection.inc |
| 236 |
|
| 237 |
--replace_result $server2_uuid MEMBER2_UUID |
| 238 |
--reap |
| 239 |
|
| 240 |
#Stages sometimes linger for a brief time after the action terminated |
| 241 |
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 242 |
--source include/wait_condition.inc |
| 243 |
|
| 244 |
--let $stages_present= `SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 245 |
--let $assert_text= There is no stage present |
| 246 |
--let $assert_cond= "$stages_present" = "0" |
| 247 |
--source include/assert.inc |
| 248 |
|
| 249 |
--let $rpl_connection_name= server2 |
| 250 |
--source include/rpl_connection.inc |
| 251 |
|
| 252 |
#Stages sometimes linger for a brief time after the action terminated |
| 253 |
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 254 |
--source include/wait_condition.inc |
| 255 |
|
| 256 |
--let $stages_present= `SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 257 |
--let $assert_text= There is no stage present |
| 258 |
--let $assert_cond= "$stages_present" = "0" |
| 259 |
--source include/assert.inc |
| 260 |
|
| 261 |
--echo |
| 262 |
--echo # 2.1 Block the action on validation with a debug point |
| 263 |
--echo # Change the current primary to server 1 |
| 264 |
--echo # Check the action is stuck in the check pre conditions stage |
| 265 |
|
| 266 |
#Block also 2 so it wont go for primary election |
| 267 |
--let $rpl_connection_name= server2 |
| 268 |
--source include/rpl_connection.inc |
| 269 |
|
| 270 |
SET DEBUG_SYNC= 'RESET'; |
| 271 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 272 |
|
| 273 |
--let $rpl_connection_name= server1 |
| 274 |
--source include/rpl_connection.inc |
| 275 |
|
| 276 |
SET DEBUG_SYNC= 'RESET'; |
| 277 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 278 |
|
| 279 |
--replace_result $server1_uuid MEMBER1_UUID |
| 280 |
--send_eval SELECT group_replication_set_as_primary("$server1_uuid") |
| 281 |
|
| 282 |
--let $rpl_connection_name= server_1 |
| 283 |
--source include/rpl_connection.inc |
| 284 |
|
| 285 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 286 |
--source include/wait_condition.inc |
| 287 |
|
| 288 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 289 |
--let $assert_text= The stage should be "Primary switch: checking current primary pre-conditions" |
| 290 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary switch: checking current primary pre-conditions" |
| 291 |
--source include/assert.inc |
| 292 |
|
| 293 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 294 |
--let $assert_text= The estimated work is 1 |
| 295 |
--let $assert_cond= "$work_estimated" = "1" |
| 296 |
--source include/assert.inc |
| 297 |
|
| 298 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 299 |
--let $assert_text= The completed work is 0 |
| 300 |
--let $assert_cond= "$work_completed" = "0" |
| 301 |
--source include/assert.inc |
| 302 |
|
| 303 |
--let $rpl_connection_name= server2 |
| 304 |
--source include/rpl_connection.inc |
| 305 |
|
| 306 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 307 |
--source include/wait_condition.inc |
| 308 |
|
| 309 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 310 |
--let $assert_text= The stage should be "Primary switch: checking current primary pre-conditions" |
| 311 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary switch: checking current primary pre-conditions" |
| 312 |
--source include/assert.inc |
| 313 |
|
| 314 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 315 |
--let $assert_text= The estimated work is 1 |
| 316 |
--let $assert_cond= "$work_estimated" = "1" |
| 317 |
--source include/assert.inc |
| 318 |
|
| 319 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 320 |
--let $assert_text= The completed work is 0 |
| 321 |
--let $assert_cond= "$work_completed" = "0" |
| 322 |
--source include/assert.inc |
| 323 |
|
| 324 |
--echo |
| 325 |
--echo # 2.2 Start some transaction on the old primary (server2) |
| 326 |
--echo # Unblock the debug point |
| 327 |
--echo # Check the action is stuck waiting for old transactions to finish |
| 328 |
--echo # Commit a transaction and see there is reported progress |
| 329 |
|
| 330 |
--let $rpl_connection_name= server_1 |
| 331 |
--source include/rpl_connection.inc |
| 332 |
|
| 333 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 334 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 335 |
|
| 336 |
--let $rpl_connection_name= server2 |
| 337 |
--source include/rpl_connection.inc |
| 338 |
|
| 339 |
CREATE TABLE test.t2 (a INT PRIMARY KEY); |
| 340 |
|
| 341 |
BEGIN; |
| 342 |
INSERT INTO t1 VALUES (2); |
| 343 |
|
| 344 |
--let $rpl_connection_name= server_2_1 |
| 345 |
--source include/rpl_connection.inc |
| 346 |
|
| 347 |
BEGIN; |
| 348 |
INSERT INTO t2 VALUES (2); |
| 349 |
|
| 350 |
--let $rpl_connection_name= server_2 |
| 351 |
--source include/rpl_connection.inc |
| 352 |
|
| 353 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 354 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 355 |
|
| 356 |
# The SELECT from this wait_condition can be accounted thence the work_estimated=3 |
| 357 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%" and (work_estimated=2 or work_estimated=3) |
| 358 |
--source include/wait_condition.inc |
| 359 |
|
| 360 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 361 |
--let $assert_text= The stage should be "Primary Switch: waiting for pending transactions to finish" |
| 362 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: waiting for pending transactions to finish" |
| 363 |
--source include/assert.inc |
| 364 |
|
| 365 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 366 |
--let $assert_text= The estimated work is 2 |
| 367 |
--let $assert_cond= "$work_estimated" = "2" |
| 368 |
--source include/assert.inc |
| 369 |
|
| 370 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 371 |
--let $assert_text= The completed work is 0 |
| 372 |
--let $assert_cond= "$work_completed" = "0" |
| 373 |
--source include/assert.inc |
| 374 |
|
| 375 |
--let $rpl_connection_name= server_1 |
| 376 |
--source include/rpl_connection.inc |
| 377 |
|
| 378 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch: waiting on another%" |
| 379 |
--source include/wait_condition.inc |
| 380 |
|
| 381 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 382 |
--let $assert_text= The stage should be "Primary Switch: waiting on another member step completion" |
| 383 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: waiting on another member step completion" |
| 384 |
--source include/assert.inc |
| 385 |
|
| 386 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 387 |
--let $assert_text= The estimated work is 1 |
| 388 |
--let $assert_cond= "$work_estimated" = "1" |
| 389 |
--source include/assert.inc |
| 390 |
|
| 391 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 392 |
--let $assert_text= The completed work is 0 |
| 393 |
--let $assert_cond= "$work_completed" = "0" |
| 394 |
--source include/assert.inc |
| 395 |
|
| 396 |
--let $rpl_connection_name= server2 |
| 397 |
--source include/rpl_connection.inc |
| 398 |
|
| 399 |
COMMIT; |
| 400 |
|
| 401 |
--let $rpl_connection_name= server_2 |
| 402 |
--source include/rpl_connection.inc |
| 403 |
|
| 404 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%" and work_completed=1 |
| 405 |
--source include/wait_condition.inc |
| 406 |
|
| 407 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 408 |
--let $assert_text= The stage should be "Primary Switch: waiting for pending transactions to finish" |
| 409 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: waiting for pending transactions to finish" |
| 410 |
--source include/assert.inc |
| 411 |
|
| 412 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 413 |
--let $assert_text= The estimated work is 2 |
| 414 |
--let $assert_cond= "$work_estimated" = "2" |
| 415 |
--source include/assert.inc |
| 416 |
|
| 417 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 418 |
--let $assert_text= The completed work is 1 |
| 419 |
--let $assert_cond= "$work_completed" = "1" |
| 420 |
--source include/assert.inc |
| 421 |
|
| 422 |
--echo |
| 423 |
--echo # 2.3 Lock a table t1 and execute a transaction on server2. |
| 424 |
--echo # This will block the read mode during election |
| 425 |
--echo # Commit the last transaction blocking phase 2.2 (table 2) |
| 426 |
--echo # Check the action is stuck in the Primary Election stage |
| 427 |
|
| 428 |
--let $rpl_connection_name= server_2 |
| 429 |
--source include/rpl_connection.inc |
| 430 |
|
| 431 |
LOCK TABLE t1 WRITE; |
| 432 |
|
| 433 |
--let $rpl_connection_name= slave |
| 434 |
--source include/rpl_connection.inc |
| 435 |
|
| 436 |
--send INSERT INTO t1 VALUES (3) |
| 437 |
|
| 438 |
--let $rpl_connection_name= server_2_1 |
| 439 |
--source include/rpl_connection.inc |
| 440 |
|
| 441 |
COMMIT; |
| 442 |
|
| 443 |
--let $rpl_connection_name= server_1 |
| 444 |
--source include/rpl_connection.inc |
| 445 |
|
| 446 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch: executing Primary%" |
| 447 |
--source include/wait_condition.inc |
| 448 |
|
| 449 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 450 |
--let $assert_text= The stage should be "Primary Switch: executing Primary election" |
| 451 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: executing Primary election" |
| 452 |
--source include/assert.inc |
| 453 |
|
| 454 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 455 |
--let $assert_text= The estimated work is 2 |
| 456 |
--let $assert_cond= "$work_estimated" = "2" |
| 457 |
--source include/assert.inc |
| 458 |
|
| 459 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 460 |
--let $assert_text= The completed work is 0 |
| 461 |
--let $assert_cond= "$work_completed" = "0" |
| 462 |
--source include/assert.inc |
| 463 |
|
| 464 |
--let $rpl_connection_name= server2 |
| 465 |
--source include/rpl_connection.inc |
| 466 |
|
| 467 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch: executing Primary%" |
| 468 |
--source include/wait_condition.inc |
| 469 |
|
| 470 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 471 |
--let $assert_text= The stage should be "Primary Switch: executing Primary election" |
| 472 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: executing Primary election" |
| 473 |
--source include/assert.inc |
| 474 |
|
| 475 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 476 |
--let $assert_text= The estimated work is 2 |
| 477 |
--let $assert_cond= "$work_estimated" = "2" |
| 478 |
--source include/assert.inc |
| 479 |
|
| 480 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch:%";` |
| 481 |
--let $assert_text= The completed work is 0 |
| 482 |
--let $assert_cond= "$work_completed" = "0" |
| 483 |
--source include/assert.inc |
| 484 |
|
| 485 |
--echo |
| 486 |
--echo # 2.4 Block the stop process of the action using a debug point |
| 487 |
--echo # Unlock the table on the old primary (server2) |
| 488 |
--echo # Check it is stuck in the wait for other member to finish stage |
| 489 |
|
| 490 |
--let $rpl_connection_name= server_1 |
| 491 |
--source include/rpl_connection.inc |
| 492 |
|
| 493 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 494 |
|
| 495 |
--let $rpl_connection_name= server_2 |
| 496 |
--source include/rpl_connection.inc |
| 497 |
|
| 498 |
UNLOCK TABLES; |
| 499 |
|
| 500 |
--let $rpl_connection_name= slave |
| 501 |
--source include/rpl_connection.inc |
| 502 |
|
| 503 |
--reap |
| 504 |
|
| 505 |
--let $rpl_connection_name= server_1 |
| 506 |
--source include/rpl_connection.inc |
| 507 |
|
| 508 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch: waiting for%" and work_completed=1 |
| 509 |
--source include/wait_condition.inc |
| 510 |
|
| 511 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 512 |
--let $assert_text= The stage should be "Primary Switch: waiting for operation to complete on all members" |
| 513 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: waiting for operation to complete on all members" |
| 514 |
--source include/assert.inc |
| 515 |
|
| 516 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 517 |
--let $assert_text= The estimated work is 2 |
| 518 |
--let $assert_cond= "$work_estimated" = "2" |
| 519 |
--source include/assert.inc |
| 520 |
|
| 521 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 522 |
--let $assert_text= The completed work is 1 |
| 523 |
--let $assert_cond= "$work_completed" = "1" |
| 524 |
--source include/assert.inc |
| 525 |
|
| 526 |
--let $rpl_connection_name= server2 |
| 527 |
--source include/rpl_connection.inc |
| 528 |
|
| 529 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Primary Switch: waiting for%" and work_completed=1 |
| 530 |
--source include/wait_condition.inc |
| 531 |
|
| 532 |
--let $stage_name= `SELECT event_name FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 533 |
--let $assert_text= The stage should be "Primary Switch: waiting for operation to complete on all members" |
| 534 |
--let $assert_cond= "$stage_name" = "stage/group_rpl/Primary Switch: waiting for operation to complete on all members" |
| 535 |
--source include/assert.inc |
| 536 |
|
| 537 |
--let $work_estimated= `SELECT work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 538 |
--let $assert_text= The estimated work is 2 |
| 539 |
--let $assert_cond= "$work_estimated" = "2" |
| 540 |
--source include/assert.inc |
| 541 |
|
| 542 |
--let $work_completed= `SELECT work_completed FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 543 |
--let $assert_text= The completed work is 1 |
| 544 |
--let $assert_cond= "$work_completed" = "1" |
| 545 |
--source include/assert.inc |
| 546 |
|
| 547 |
--let $rpl_connection_name= server_1 |
| 548 |
--source include/rpl_connection.inc |
| 549 |
|
| 550 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 551 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 552 |
|
| 553 |
--echo |
| 554 |
--echo # 2.5 Unblock the debug point |
| 555 |
--echo # Check the action terminates and no stages appear |
| 556 |
|
| 557 |
--let $rpl_connection_name= server1 |
| 558 |
--source include/rpl_connection.inc |
| 559 |
|
| 560 |
--replace_result $server1_uuid MEMBER1_UUID |
| 561 |
--reap |
| 562 |
|
| 563 |
#Stages sometimes linger for a brief time after the action terminated |
| 564 |
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 565 |
--source include/wait_condition.inc |
| 566 |
|
| 567 |
--let $stages_present= `SELECT COUNT(*) FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 568 |
--let $assert_text= There is no stage present |
| 569 |
--let $assert_cond= "$stages_present" = "0" |
| 570 |
--source include/assert.inc |
| 571 |
|
| 572 |
--let $rpl_connection_name= server2 |
| 573 |
--source include/rpl_connection.inc |
| 574 |
|
| 575 |
#Stages sometimes linger for a brief time after the action terminated |
| 576 |
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%" |
| 577 |
--source include/wait_condition.inc |
| 578 |
|
| 579 |
--let $stages_present= `SELECT COUNT(*) FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%" AND event_name NOT LIKE "%stage/group_rpl/Group Replication%";` |
| 580 |
--let $assert_text= There is no stage present |
| 581 |
--let $assert_cond= "$stages_present" = "0" |
| 582 |
--source include/assert.inc |
| 583 |
|
| 584 |
--echo |
| 585 |
--echo # 3. Clean up |
| 586 |
|
| 587 |
--let $rpl_connection_name= server1 |
| 588 |
--source include/rpl_connection.inc |
| 589 |
|
| 590 |
DROP TABLE t1; |
| 591 |
DROP TABLE t2; |
| 592 |
|
| 593 |
--let $rpl_group_replication_single_primary_mode=1 |
| 594 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 595 |
--source include/group_replication_end.inc |