Debian Codegraph @

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

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