Debian Codegraph @

mysql-test/suite/group_replication/t/gr_certification_data_psi_memory.test

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