| 1 |
################################################################################ |
| 2 |
# BUG#20776314 THE CERTIFIER BROADCAST THREAD IS PRONE TO CONCURRENCY PROBLEMS |
| 3 |
# |
| 4 |
# This test fixes the first issue with the bug : |
| 5 |
# |
| 6 |
# If the garbage collection is in progress, we should discard all the |
| 7 |
# incoming stable set message (certifier messages) as they will update the |
| 8 |
# stable_gtid_set which will cause a concurrency problem. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0. The test requires two servers: M1 and M2. |
| 12 |
# 1. With both the members ONLINE. Commit a transaction (T1) on M1, that will |
| 13 |
# be certified and applied on both members. Wait for first round of garbage |
| 14 |
# collection to finish. |
| 15 |
# 2. Stop GR on M2. Set DEBUG point to block garbage collection on M2. Start GR |
| 16 |
# on M2. |
| 17 |
# 3. Commit a transaction (T2) on M1, that will be certified and applied on both |
| 18 |
# members. Wait for second round of garbage collection to finish on M1. Wait |
| 19 |
# for the third round of garbage collection to finish on M2. |
| 20 |
# 4. Clean up. |
| 21 |
################################################################################ |
| 22 |
|
| 23 |
--source include/big_test.inc |
| 24 |
--source include/have_debug.inc |
| 25 |
--source include/have_group_replication_plugin.inc |
| 26 |
--source include/group_replication.inc |
| 27 |
|
| 28 |
--connection server1 |
| 29 |
--echo ############################################################ |
| 30 |
--echo # Commit a transaction (T1) on server 1, that will be |
| 31 |
--echo # certified and applied on both members. |
| 32 |
CREATE TABLE t1(i INT PRIMARY KEY); |
| 33 |
--source include/rpl_sync.inc |
| 34 |
|
| 35 |
--connection server1 |
| 36 |
--echo # Wait for the first round of garbage collection to finish on server 1. |
| 37 |
--let $wait_timeout= 65 |
| 38 |
--let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid) |
| 39 |
--source include/wait_condition.inc |
| 40 |
|
| 41 |
--connection server2 |
| 42 |
--echo # Wait for the first round of garbage collection to finish on server 2. |
| 43 |
--let $wait_timeout= 65 |
| 44 |
--let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid) |
| 45 |
--source include/wait_condition.inc |
| 46 |
|
| 47 |
--echo # First round of garbage collection finished |
| 48 |
--let $first_garbage_collection_transactions_committed= `SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)` |
| 49 |
|
| 50 |
--connection server2 |
| 51 |
--echo ############################################################ |
| 52 |
--echo # Block garbage collection on server 2. |
| 53 |
--source include/stop_group_replication.inc |
| 54 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 55 |
# Setting the debug flag for the garbage collection blocking. |
| 56 |
SET @@GLOBAL.DEBUG= '+d,certifier_garbage_collection_block'; |
| 57 |
--source include/start_group_replication.inc |
| 58 |
|
| 59 |
--connection server1 |
| 60 |
--echo ############################################################ |
| 61 |
--echo # Commit a transaction (T2) on server 1, that will be |
| 62 |
--echo # certified and applied on both members. |
| 63 |
INSERT INTO t1 VALUES(1); |
| 64 |
--source include/rpl_sync.inc |
| 65 |
|
| 66 |
--connection server1 |
| 67 |
--echo # Wait for the second round of garbage collection to finish on server 1. |
| 68 |
--let $wait_timeout= 65 |
| 69 |
--let $wait_condition= SELECT Transactions_committed_all_members<>"$first_garbage_collection_transactions_committed" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid) |
| 70 |
--source include/wait_condition.inc |
| 71 |
|
| 72 |
--connection server2 |
| 73 |
--echo # Wait for the third round of garbage collection to finish on server 2. |
| 74 |
--echo # Round on which garbage collection will be unblocked. |
| 75 |
# wait_timeout = 60 + 60 + 30 = 150 |
| 76 |
# 2nd GC 3rd GC extra |
| 77 |
|
| 78 |
--let $wait_timeout= 150 |
| 79 |
--let $wait_condition= SELECT Transactions_committed_all_members<>"$first_garbage_collection_transactions_committed" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid) |
| 80 |
--source include/wait_condition.inc |
| 81 |
|
| 82 |
# Cleanup |
| 83 |
|
| 84 |
--connection server2 |
| 85 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 86 |
|
| 87 |
--connection server1 |
| 88 |
DROP TABLE t1; |
| 89 |
--source include/group_replication_end.inc |