| 1 |
################################################################################ |
| 2 |
# Validate that primary releases all allocated memory related to |
| 3 |
# "memory/sql/Gtid_set::Interval_chunk" event name. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires one server: M1. |
| 7 |
# 1. Populate server with data to alloc memory using |
| 8 |
# Gtid_set::Interval_chunk key. |
| 9 |
# 2. Assert values on thread and global counters before |
| 10 |
# running garbage collect. |
| 11 |
# 3. Wait for execution of another garbage collection |
| 12 |
# 4. Assert values on thread and global counters after |
| 13 |
# running garbage collect. |
| 14 |
# 5. Cleanup |
| 15 |
################################################################################ |
| 16 |
|
| 17 |
--source include/have_nodebug.inc |
| 18 |
--source include/not_valgrind.inc |
| 19 |
--source include/not_asan.inc |
| 20 |
--source include/big_test.inc |
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--let $rpl_skip_group_replication_start= 1 |
| 23 |
--source include/group_replication.inc |
| 24 |
|
| 25 |
--source include/start_and_bootstrap_group_replication.inc |
| 26 |
|
| 27 |
|
| 28 |
--echo |
| 29 |
--echo ############################################################ |
| 30 |
--echo # 1. Populate server with data to alloc memory using |
| 31 |
--echo # Gtid_set::Interval_chunk key. |
| 32 |
|
| 33 |
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; |
| 34 |
|
| 35 |
BEGIN; |
| 36 |
INSERT INTO t1 (c2) values (2); |
| 37 |
INSERT INTO t1 (c2) values (2); |
| 38 |
INSERT INTO t1 (c2) values (2); |
| 39 |
INSERT INTO t1 (c2) values (2); |
| 40 |
INSERT INTO t1 (c2) values (2); |
| 41 |
COMMIT; |
| 42 |
|
| 43 |
--exec $MYSQL_SLAP --create-schema=test --delimiter=";" --iterations=100 --query="INSERT INTO t1 (c2) SELECT c2 FROM t1 LIMIT 5" --concurrency=1 --silent |
| 44 |
|
| 45 |
|
| 46 |
--echo |
| 47 |
--echo ############################################################ |
| 48 |
--echo # 2. Assert values on thread and global counters before |
| 49 |
--echo # running garbage collect. |
| 50 |
|
| 51 |
--let $applier_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_by_thread_by_event_name JOIN performance_schema.threads USING(thread_id) WHERE event_name = "memory/sql/Gtid_set::Interval_chunk" AND name = "thread/group_rpl/THD_applier_module_receiver"` |
| 52 |
--let $certifier_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_by_thread_by_event_name JOIN performance_schema.threads USING(thread_id) WHERE event_name = "memory/sql/Gtid_set::Interval_chunk" AND name = "thread/group_rpl/THD_certifier_broadcast"` |
| 53 |
--let $global_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME = "memory/sql/Gtid_set::Interval_chunk"` |
| 54 |
|
| 55 |
--let $assert_text= Global counters shall been higher than sum of applier and certifier threads. |
| 56 |
--let $assert_cond= [SELECT $applier_bytes_used + $certifier_bytes_used] <= $global_bytes_used |
| 57 |
--source include/assert.inc |
| 58 |
|
| 59 |
|
| 60 |
--echo |
| 61 |
--echo ############################################################ |
| 62 |
--echo # 3. Wait for execution of another garbage collection |
| 63 |
|
| 64 |
--let $wait_timeout= 150 |
| 65 |
--let $wait_condition= SELECT Count_transactions_rows_validating=5 FROM performance_schema.replication_group_member_stats WHERE member_id IN (SELECT @@server_uuid) |
| 66 |
--source include/wait_condition.inc |
| 67 |
|
| 68 |
|
| 69 |
--echo |
| 70 |
--echo ############################################################ |
| 71 |
--echo # 4. Assert values on thread and global counters after |
| 72 |
--echo # running garbage collect. |
| 73 |
|
| 74 |
--let $applier_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_by_thread_by_event_name JOIN performance_schema.threads USING(thread_id) WHERE event_name = "memory/sql/Gtid_set::Interval_chunk" AND name = "thread/group_rpl/THD_applier_module_receiver"` |
| 75 |
--let $certifier_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_by_thread_by_event_name JOIN performance_schema.threads USING(thread_id) WHERE event_name = "memory/sql/Gtid_set::Interval_chunk" AND name = "thread/group_rpl/THD_certifier_broadcast"` |
| 76 |
--let $global_bytes_used= `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME = "memory/sql/Gtid_set::Interval_chunk"` |
| 77 |
|
| 78 |
--let $assert_text= Global counters shall been higher than sum of applier and certifier threads. |
| 79 |
--let $assert_cond= [SELECT $applier_bytes_used + $certifier_bytes_used] <= $global_bytes_used |
| 80 |
--source include/assert.inc |
| 81 |
|
| 82 |
|
| 83 |
--echo |
| 84 |
--echo ############################################################ |
| 85 |
--echo # 5. Cleanup |
| 86 |
|
| 87 |
DROP TABLE t1; |
| 88 |
|
| 89 |
--source include/group_replication_end.inc |