Debian Codegraph @

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

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