| 1 |
############################################################################### |
| 2 |
# This test verifies following for 'consistent_transactions' |
| 3 |
# event name: |
| 4 |
# - Verify that entries corresponding to the |
| 5 |
# 'consistent_transactions' performance schema |
| 6 |
# instrumented memory are in the memory table only during the |
| 7 |
# execution of the group replication plugin. |
| 8 |
# - Verify that the sum of bytes allocated is greater than zero for a |
| 9 |
# transaction. |
| 10 |
# |
| 11 |
# Test: |
| 12 |
# 0. The test requires two servers: M1 and M2. |
| 13 |
# 1. Verify that the entries corresponding to the |
| 14 |
# instrumented memory are in the setup instruments |
| 15 |
# table and the memory summary tables for the event |
| 16 |
# consistent_transactions. |
| 17 |
# 2. Verify that the sum of bytes allocated is greater than |
| 18 |
# zero for a transaction. |
| 19 |
# 3. Stop GR |
| 20 |
# 4. Verify that the entries corresponding to the instrumented |
| 21 |
# consistent_transactions remain in the tables after stopping GR. |
| 22 |
# 5. Assert that the number of bytes allocated for consistent_transactions |
| 23 |
# event must be 0. |
| 24 |
# 6. Clean up. |
| 25 |
############################################################################### |
| 26 |
|
| 27 |
--source include/big_test.inc |
| 28 |
--source include/have_debug_sync.inc |
| 29 |
--source include/have_group_replication_plugin.inc |
| 30 |
--source include/group_replication.inc |
| 31 |
|
| 32 |
|
| 33 |
--echo |
| 34 |
--echo ############################################################ |
| 35 |
--echo # 1. Verify that the entries corresponding to the |
| 36 |
--echo # instrumented memory are in the setup instruments |
| 37 |
--echo # table and the memory summary tables for the event |
| 38 |
--echo # consistent_transactions. |
| 39 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions'; |
| 40 |
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions in the setup_instruments table after starting GR' |
| 41 |
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/consistent_transactions" |
| 42 |
--source include/assert.inc |
| 43 |
|
| 44 |
SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/consistent_transactions'; |
| 45 |
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions in the memory_summary_global_by_event_name table after starting GR' |
| 46 |
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/consistent_transactions" |
| 47 |
--source include/assert.inc |
| 48 |
|
| 49 |
|
| 50 |
--echo |
| 51 |
--echo ############################################################ |
| 52 |
--echo # 2. Verify that the sum of bytes allocated is greater than |
| 53 |
--echo # zero for a transaction. |
| 54 |
--let $rpl_connection_name= server_1 |
| 55 |
--source include/rpl_connection.inc |
| 56 |
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=innodb; |
| 57 |
SET @@SESSION.group_replication_consistency= AFTER; |
| 58 |
SET @@GLOBAL.DEBUG= '+d,group_replication_consistency_manager_after_certification'; |
| 59 |
--send INSERT INTO t1 VALUES(1); |
| 60 |
|
| 61 |
--let $rpl_connection_name= server1 |
| 62 |
--source include/rpl_connection.inc |
| 63 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_consistency_manager_after_certification_reached"; |
| 64 |
|
| 65 |
--let $assert_text= 'The sum bytes allocated must be greater than 0' |
| 66 |
--let $assert_cond= [SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/consistent_transactions"] > 0 |
| 67 |
--source include/assert.inc |
| 68 |
|
| 69 |
SET @@GLOBAL.DEBUG= '-d,group_replication_consistency_manager_after_certification'; |
| 70 |
SET DEBUG_SYNC= "now SIGNAL signal.group_replication_consistency_manager_after_certification_continue"; |
| 71 |
|
| 72 |
|
| 73 |
--let $rpl_connection_name= server_1 |
| 74 |
--source include/rpl_connection.inc |
| 75 |
--reap |
| 76 |
|
| 77 |
DROP TABLE t1; |
| 78 |
|
| 79 |
|
| 80 |
--echo |
| 81 |
--echo ############################################################ |
| 82 |
--echo # 3. Stop GR |
| 83 |
--source include/stop_group_replication.inc |
| 84 |
--source include/uninstall_group_replication_plugin.inc |
| 85 |
|
| 86 |
|
| 87 |
--echo |
| 88 |
--echo ############################################################## |
| 89 |
--echo # 4. Verify that the entries corresponding to the instrumented |
| 90 |
--echo # consistent_transactions remain in the tables after |
| 91 |
--echo # stopping GR. |
| 92 |
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions'; |
| 93 |
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions in the setup_instruments table after stopping GR' |
| 94 |
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/consistent_transactions" |
| 95 |
--source include/assert.inc |
| 96 |
|
| 97 |
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions in the memory_summary_global_by_event_name table after stopping GR' |
| 98 |
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/consistent_transactions" |
| 99 |
--source include/assert.inc |
| 100 |
|
| 101 |
|
| 102 |
--echo |
| 103 |
--echo ################################################################# |
| 104 |
--echo # 5. Assert that the number of bytes allocated for |
| 105 |
--echo # consistent_transactions event must be 0. |
| 106 |
--let $assert_text= 'The sum of bytes allocated must be zero after stopping GR' |
| 107 |
--let $assert_cond= CURRENT_NUMBER_OF_BYTES_USED = 0 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/consistent_transactions" |
| 108 |
--source include/assert.inc |
| 109 |
|
| 110 |
|
| 111 |
--echo |
| 112 |
--echo ################################################################# |
| 113 |
--echo # 6. Clean up. |
| 114 |
--source include/install_group_replication_plugin.inc |
| 115 |
--source include/group_replication_end.inc |