| 1 |
############################################################################### |
| 2 |
# ==== Purpose ==== |
| 3 |
# This test verifies following for 'Log_event' event name in replica: |
| 4 |
# - Verify that current_number_of_bytes_used entry in performance schema |
| 5 |
# memory_summary_by_thread_by_event_name table is matching before and after |
| 6 |
# the transactions |
| 7 |
# - Verify that current_number_of_bytes_used entry in performance schema |
| 8 |
# memory_summary_by_thread_by_event_name and |
| 9 |
# memory_summary_global_by_event_name are matching before and after the |
| 10 |
# transactions |
| 11 |
# |
| 12 |
# ==== Requirements ==== |
| 13 |
# 1) At thread level, after the transaction, performance schema instrumented |
| 14 |
# current_number_of_bytes_used count should be same as the before count. |
| 15 |
# 2) Thread level performance schema instrumented current_number_of_bytes_used |
| 16 |
# count should match with corresponding global level count before and after |
| 17 |
# the transactions |
| 18 |
# |
| 19 |
# ==== Implementation ==== |
| 20 |
# 1. Initial setup |
| 21 |
# 2. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' is |
| 22 |
# same at global and thread level |
| 23 |
# 3. Perform transactions and sync with replica |
| 24 |
# 4. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' is |
| 25 |
# same at global and thread level after transactions |
| 26 |
# 5. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' is |
| 27 |
# same at thread level before and after transactions |
| 28 |
# 6. Cleanup |
| 29 |
# |
| 30 |
# ==== References ==== |
| 31 |
# BUG#35546877: Memory consumption isssue |
| 32 |
############################################################################### |
| 33 |
|
| 34 |
|
| 35 |
--source include/have_binlog_format_row.inc |
| 36 |
--source include/only_mts_replica_parallel_workers.inc |
| 37 |
|
| 38 |
--echo |
| 39 |
--echo # 1. Initial setup |
| 40 |
--source include/master-slave.inc |
| 41 |
|
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # 2. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' |
| 45 |
--echo # is same at global and thread level |
| 46 |
--source include/rpl_connection_slave.inc |
| 47 |
|
| 48 |
--let $thread_current_number_of_bytes_used_before = `SELECT SUM(CURRENT_NUMBER_OF_BYTES_USED) AS THREAD FROM performance_schema.memory_summary_by_thread_by_event_name WHERE EVENT_NAME = 'memory/sql/Log_event' GROUP BY EVENT_NAME` |
| 49 |
|
| 50 |
--let $global_current_number_of_bytes_used_before = `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME='memory/sql/Log_event'` |
| 51 |
|
| 52 |
--let $assert_cond= [ SELECT $thread_current_number_of_bytes_used_before = $global_current_number_of_bytes_used_before] |
| 53 |
--let $assert_text= Before memory count matches |
| 54 |
--source include/assert.inc |
| 55 |
|
| 56 |
--echo |
| 57 |
--echo # 3. Perform transactions and sync with replica |
| 58 |
--source include/rpl_connection_master.inc |
| 59 |
|
| 60 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 61 |
INSERT INTO t1 VALUES (1); |
| 62 |
UPDATE t1 SET c1 = 10; |
| 63 |
DELETE FROM t1; |
| 64 |
|
| 65 |
--source include/sync_slave_sql_with_master.inc |
| 66 |
|
| 67 |
# Sleep an extra second for replica to settle |
| 68 |
--sleep 1 |
| 69 |
|
| 70 |
--echo |
| 71 |
--echo # 4. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' |
| 72 |
--echo # is same at global and thread level after transactions |
| 73 |
--let $thread_current_number_of_bytes_used_after = `SELECT SUM(CURRENT_NUMBER_OF_BYTES_USED) AS THREAD FROM performance_schema.memory_summary_by_thread_by_event_name WHERE EVENT_NAME = 'memory/sql/Log_event' group by EVENT_NAME` |
| 74 |
|
| 75 |
--let $global_current_number_of_bytes_used_after = `SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME='memory/sql/Log_event'` |
| 76 |
|
| 77 |
--let $assert_cond= [ SELECT $thread_current_number_of_bytes_used_after = $global_current_number_of_bytes_used_after] |
| 78 |
--let $assert_text= After memory count matches |
| 79 |
--source include/assert.inc |
| 80 |
|
| 81 |
--echo |
| 82 |
--echo # 5. Verify that current_number_of_bytes_used for 'memory/sql/Log_event' |
| 83 |
--echo # is same at thread level before and after transactions |
| 84 |
--let $assert_cond= [ SELECT $thread_current_number_of_bytes_used_before = $thread_current_number_of_bytes_used_after] |
| 85 |
--let $assert_text= Thread Memory count matches |
| 86 |
--source include/assert.inc |
| 87 |
|
| 88 |
--echo |
| 89 |
--echo # 6. Cleanup |
| 90 |
--source include/rpl_connection_master.inc |
| 91 |
DROP TABLE t1; |
| 92 |
--source include/rpl_end.inc |