|
| 1 | +################################################################################ |
| 2 | +# Validate that certification info garbage collection do not purge more data |
| 3 | +# than it should. |
| 4 | +# |
| 5 | +# Test: |
| 6 | +# 0. The test requires two servers: M1 and M2. |
| 7 | +# 1. Create a table on server1. |
| 8 | +# 2. Set a debug sync before broadcast message to group on |
| 9 | +# connection server_1. |
| 10 | +# Commit a transaction that will be block before broadcast. |
| 11 | +# 3. Wait until server_1 connection reaches the |
| 12 | +# group_replication_before_message_broadcast debug sync point. |
| 13 | +# 4. Execute a transaction on server2, that will reach first |
| 14 | +# certification, since server_1 is blocked before broadcast. |
| 15 | +# 5. Suspend pipeline on server2. |
| 16 | +# 6. Resume the transaction on server_1 |
| 17 | +# 7. Make sure the pipeline is suspended on server2. |
| 18 | +# 8. Wait until certification info garbage collector does |
| 19 | +# its work. |
| 20 | +# 9. Resume the pipeline on server2. |
| 21 | +# 10. Execute a new transaction in order to have a sync point |
| 22 | +# to make the test deterministic, |
| 23 | +# Validate that data and GTIDs are correct. |
| 24 | +# 11. Clean up. |
| 25 | +################################################################################ |
| 26 | +--source include/have_debug_sync.inc |
| 27 | +--source include/big_test.inc |
| 28 | +--source ../inc/have_group_replication_plugin.inc |
| 29 | +--source ../inc/group_replication.inc |
| 30 | + |
| 31 | +--echo |
| 32 | +--echo ############################################################ |
| 33 | +--echo # 1. Create a table on server1. |
| 34 | +CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)); |
| 35 | +INSERT INTO t1 VALUE(1, 1); |
| 36 | +--source include/rpl_sync.inc |
| 37 | + |
| 38 | +--echo |
| 39 | +--echo ############################################################ |
| 40 | +--echo # 2. Set a debug sync before broadcast message to group on |
| 41 | +--echo # connection server_1. |
| 42 | +--echo # Commit a transaction that will be block before broadcast. |
| 43 | +--let $rpl_connection_name= server_1 |
| 44 | +--source include/rpl_connection.inc |
| 45 | +SET @@GLOBAL.DEBUG='+d,group_replication_before_message_broadcast'; |
| 46 | +BEGIN; |
| 47 | +UPDATE t1 SET b=10 WHERE a=1; |
| 48 | +--send COMMIT |
| 49 | + |
| 50 | +--echo |
| 51 | +--echo ############################################################ |
| 52 | +--echo # 3. Wait until server_1 connection reaches the |
| 53 | +--echo # group_replication_before_message_broadcast debug sync point. |
| 54 | +--let $rpl_connection_name= server1 |
| 55 | +--source include/rpl_connection.inc |
| 56 | +--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now' |
| 57 | +--source include/wait_condition.inc |
| 58 | + |
| 59 | +--echo |
| 60 | +--echo ############################################################ |
| 61 | +--echo # 4. Execute a transaction on server2, that will reach first |
| 62 | +--echo # certification, since server_1 is blocked before broadcast. |
| 63 | +--let $rpl_connection_name= server2 |
| 64 | +--source include/rpl_connection.inc |
| 65 | +UPDATE t1 SET b=20 WHERE a=1; |
| 66 | + |
| 67 | +--echo |
| 68 | +--echo ############################################################ |
| 69 | +--echo # 5. Suspend pipeline on server2. |
| 70 | +SET @@GLOBAL.DEBUG='+d,group_replication_before_apply_data_packet'; |
| 71 | + |
| 72 | +--echo |
| 73 | +--echo ############################################################ |
| 74 | +--echo # 6. Resume the transaction on server_1 |
| 75 | +--let $rpl_connection_name= server1 |
| 76 | +--source include/rpl_connection.inc |
| 77 | +SET DEBUG_SYNC='now SIGNAL waiting'; |
| 78 | +SET @@GLOBAL.DEBUG='-d,group_replication_before_message_broadcast'; |
| 79 | + |
| 80 | +--let $rpl_connection_name= server_1 |
| 81 | +--source include/rpl_connection.inc |
| 82 | +--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT |
| 83 | +--reap |
| 84 | + |
| 85 | +--echo |
| 86 | +--echo ############################################################ |
| 87 | +--echo # 7. Make sure the pipeline is suspended on server2. |
| 88 | +--let $rpl_connection_name= server2 |
| 89 | +--source include/rpl_connection.inc |
| 90 | +--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now' |
| 91 | +--source include/wait_condition.inc |
| 92 | + |
| 93 | +--echo |
| 94 | +--echo ############################################################ |
| 95 | +--echo # 8. Wait until certification info garbage collector does |
| 96 | +--echo # its work. |
| 97 | +--let $gtid_assignment_block_size= `SELECT @@GLOBAL.group_replication_gtid_assignment_block_size;` |
| 98 | +--let $expected_gtid_set= $group_replication_group_name:1-4:1000002 |
| 99 | +if ($gtid_assignment_block_size == 1) |
| 100 | +{ |
| 101 | + --let $expected_gtid_set= $group_replication_group_name:1-5 |
| 102 | +} |
| 103 | +--let $wait_condition= SELECT transactions_committed_all_members = "$expected_gtid_set" from performance_schema.replication_group_member_stats; |
| 104 | +--let $wait_timeout= 150 |
| 105 | +--source include/wait_condition.inc |
| 106 | + |
| 107 | +--echo |
| 108 | +--echo ############################################################ |
| 109 | +--echo # 9. Resume the pipeline on server2. |
| 110 | +SET DEBUG_SYNC='now SIGNAL continue_apply'; |
| 111 | +SET @@GLOBAL.DEBUG='-d,group_replication_before_apply_data_packet'; |
| 112 | + |
| 113 | +--echo |
| 114 | +--echo ############################################################ |
| 115 | +--echo # 10. Execute a new transaction in order to have a sync point |
| 116 | +--echo # to make the test deterministic, |
| 117 | +--echo # Validate that data and GTIDs are correct. |
| 118 | +--let $rpl_connection_name= server1 |
| 119 | +--source include/rpl_connection.inc |
| 120 | +INSERT INTO t1 VALUE(2, 2); |
| 121 | +--source include/rpl_sync.inc |
| 122 | + |
| 123 | +--let $expected_gtid_set= $group_replication_group_name:1-5:1000002 |
| 124 | +if ($gtid_assignment_block_size == 1) |
| 125 | +{ |
| 126 | + --let $expected_gtid_set= $group_replication_group_name:1-6 |
| 127 | +} |
| 128 | + |
| 129 | +--let $assert_text= GTID_EXECUTED must contain 6 transactions |
| 130 | +--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid_set"; |
| 131 | +--source include/assert.inc |
| 132 | + |
| 133 | +--let $rpl_connection_name= server2 |
| 134 | +--source include/rpl_connection.inc |
| 135 | +--let $assert_text= GTID_EXECUTED must contain 6 transactions |
| 136 | +--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid_set"; |
| 137 | +--source include/assert.inc |
| 138 | + |
| 139 | +--let $diff_tables=server1:t1, server2:t1 |
| 140 | +--source include/diff_tables.inc |
| 141 | + |
| 142 | + |
| 143 | +--echo |
| 144 | +--echo ############################################################ |
| 145 | +--echo # 11. Clean up. |
| 146 | +DROP TABLE t1; |
| 147 | + |
| 148 | +--source ../inc/group_replication_end.inc |
0 commit comments