| 1 |
############################################################################### |
| 2 |
# This test verifies certification info garbage collection metrics. |
| 3 |
# |
| 4 |
# Test: |
| 5 |
# 0. The test requires two servers: M1. |
| 6 |
# 1. Start Group Replication and force a garbage collect |
| 7 |
# high number on write set of certification info. |
| 8 |
# 2. Run some transactions on the group to increase |
| 9 |
# garbage collection size. |
| 10 |
# 3. Remove certification info higher gtid set ref and |
| 11 |
# enable debug point that will simulate a one time |
| 12 |
# overflow on garbage collect counter. |
| 13 |
# 4. As certification garbage collect simulates an overflow |
| 14 |
# it will not delete values from certification info. |
| 15 |
# 5. Assert there are 3000 rows on certification info. |
| 16 |
# 6. Remove debug point, already unset in the code |
| 17 |
# 7. Execute one more transaction to update stable set and |
| 18 |
# garbage collect will clean certification info. |
| 19 |
# 8. Cleanup |
| 20 |
############################################################################### |
| 21 |
|
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/big_test.inc |
| 24 |
--source include/not_valgrind.inc |
| 25 |
--source include/not_asan.inc |
| 26 |
--source include/have_group_replication_plugin.inc |
| 27 |
--let $rpl_skip_group_replication_start= 1 |
| 28 |
--source include/group_replication.inc |
| 29 |
|
| 30 |
|
| 31 |
--echo |
| 32 |
--echo ############################################################ |
| 33 |
--echo # 1. Start Group Replication and force a garbage collect |
| 34 |
--echo # high number on write set of certification info. |
| 35 |
|
| 36 |
--source include/start_and_bootstrap_group_replication.inc |
| 37 |
|
| 38 |
--let $debug_point=group_replication_ci_rows_counter_high |
| 39 |
--source include/add_debug_point.inc |
| 40 |
|
| 41 |
|
| 42 |
--echo |
| 43 |
--echo ############################################################ |
| 44 |
--echo # 2. Run some transactions on the group to increase |
| 45 |
--echo # garbage collection size. |
| 46 |
|
| 47 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INT UNIQUE KEY NOT NULL, c3 INT UNIQUE KEY NOT NULL); |
| 48 |
--disable_query_log |
| 49 |
--let $cnt=1000 |
| 50 |
while($cnt) |
| 51 |
{ |
| 52 |
--eval INSERT INTO t1 VALUES ($cnt, $cnt, $cnt) |
| 53 |
--dec $cnt |
| 54 |
} |
| 55 |
--enable_query_log |
| 56 |
|
| 57 |
|
| 58 |
--echo |
| 59 |
--echo ############################################################ |
| 60 |
--echo # 3. Remove certification info higher gtid set ref and |
| 61 |
--echo # enable debug point that will simulate a one time |
| 62 |
--echo # overflow on garbage collect counter. |
| 63 |
|
| 64 |
--let $debug_point=group_replication_ci_rows_counter_high |
| 65 |
--source include/remove_debug_point.inc |
| 66 |
|
| 67 |
--let $debug_point=group_replication_garbage_collect_counter_overflow |
| 68 |
--source include/add_debug_point.inc |
| 69 |
|
| 70 |
|
| 71 |
--echo |
| 72 |
--echo ############################################################ |
| 73 |
--echo # 4. As certification garbage collect simulates an overflow |
| 74 |
--echo # it will not delete values from certification info. |
| 75 |
|
| 76 |
--let $gtid_executed = `SELECT @@GLOBAL.gtid_executed` |
| 77 |
--let $wait_timeout= 150 |
| 78 |
--let $wait_condition= SELECT received_transaction_set="$gtid_executed" FROM performance_schema.replication_connection_status WHERE channel_name="group_replication_applier"; |
| 79 |
--source include/wait_condition.inc |
| 80 |
|
| 81 |
|
| 82 |
--echo |
| 83 |
--echo ############################################################ |
| 84 |
--echo # 5. Assert there are 3000 rows on certification info. |
| 85 |
|
| 86 |
--let $count_transactions_validating= query_get_value(SELECT Count_transactions_rows_validating from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Count_transactions_rows_validating, 1) |
| 87 |
--let $assert_text= 'Count_transactions_rows_validating must be 3000' |
| 88 |
--let $assert_cond= $count_transactions_validating = 3000 |
| 89 |
--source include/assert.inc |
| 90 |
|
| 91 |
|
| 92 |
--echo |
| 93 |
--echo ############################################################ |
| 94 |
--echo # 6. Remove debug point, already unset in the code |
| 95 |
|
| 96 |
--let $debug_point=group_replication_garbage_collect_counter_overflow |
| 97 |
--source include/remove_debug_point.inc |
| 98 |
|
| 99 |
|
| 100 |
--echo |
| 101 |
--echo ############################################################ |
| 102 |
--echo # 7. Execute one more transaction to update stable set and |
| 103 |
--echo # garbage collect will clean certification info. |
| 104 |
|
| 105 |
INSERT INTO t1 VALUES (1001, 1001, 1001); |
| 106 |
|
| 107 |
--let $wait_timeout= 150 |
| 108 |
--let $wait_condition= SELECT Count_transactions_rows_validating=3 FROM performance_schema.replication_group_member_stats WHERE member_id IN (SELECT @@server_uuid) |
| 109 |
--source include/wait_condition.inc |
| 110 |
|
| 111 |
|
| 112 |
--echo |
| 113 |
--echo ################################################################# |
| 114 |
--echo # 8. Cleanup |
| 115 |
|
| 116 |
DROP TABLE t1; |
| 117 |
--source include/group_replication_end.inc |