Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test verifies following for 'Gcs_message_data::m_buffer' event name:
3 # - Verify that entries corresponding to the 'Gcs_message_data::m_buffer'
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 # Gcs_message_data::m_buffer remain in the tables after stopping GR.
20 # 5. Assert that the number of bytes allocated for
21 # Gcs_message_data::m_buffer event must be 0.
22 # 6. Cleanup
23 ###############################################################################
24
25 --source include/not_binlog_transaction_compression_on.inc
26 --source include/big_test.inc
27 --source include/have_debug_sync.inc
28 --source include/have_group_replication_plugin.inc
29 --source include/group_replication.inc
30
31 --echo
32 --echo ############################################################
33 --echo # 1. Verify that the entries corresponding to the
34 --echo # instrumented memory are in the setup instruments
35 --echo # table and the memory summary tables.
36 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/Gcs_message_data::m_buffer';
37 --let $assert_text= 'There should be 1 entry corresponding to the Gcs_message_data::m_buffer in the setup_instruments table after starting GR'
38 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/Gcs_message_data::m_buffer"
39 --source include/assert.inc
40 SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/Gcs_message_data::m_buffer';
41 --let $assert_text= 'There should be 1 entry corresponding to the Gcs_message_data::m_buffer in the memory_summary_global_by_event_name table after starting GR'
42 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/Gcs_message_data::m_buffer"
43 --source include/assert.inc
44
45
46 --echo
47 --echo ############################################################
48 --echo # 2. Verify that the sum of bytes allocated is greater than
49 --echo # zero for a transaction and zero after transaction is
50 --echo # finished.
51 --let $rpl_connection_name= server1
52 --source include/rpl_connection.inc
53 CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB) ENGINE=innodb;
54 --source include/rpl_sync.inc
55
56 --let $rpl_connection_name= server_1
57 --source include/rpl_connection.inc
58 SET @@GLOBAL.DEBUG= '+d,group_replication_before_message_broadcast';
59 # insert size: 1 MB
60 BEGIN;
61 INSERT INTO t1 VALUES (1, repeat('a',1024*1024));
62 --send COMMIT
63
64
65 --let $rpl_connection_name= server1
66 --source include/rpl_connection.inc
67 --let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
68 --source include/wait_condition.inc
69
70
71 --let $assert_text= 'The sum of bytes allocated must be greater than 1MB'
72 --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/Gcs_message_data::m_buffer"] > 1000000
73 --source include/assert.inc
74
75 SET @@GLOBAL.DEBUG= '+d,group_replication_after_before_commit_hook';
76 SET @@GLOBAL.DEBUG= '-d,group_replication_before_message_broadcast';
77 SET DEBUG_SYNC= "now SIGNAL waiting";
78
79
80 --let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
81 --source include/wait_condition.inc
82
83 --let $assert_text= 'The sum of bytes allocated must be 0'
84 --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/Gcs_message_data::m_buffer"
85 --source include/assert.inc
86
87 SET @@GLOBAL.DEBUG= '-d,group_replication_after_before_commit_hook';
88 SET DEBUG_SYNC= "now SIGNAL signal.group_replication_after_before_commit_hook_continue";
89
90 --let $rpl_connection_name= server_1
91 --source include/rpl_connection.inc
92 --reap
93
94 DROP TABLE t1;
95
96
97 --echo
98 --echo ############################################################
99 --echo # 3. Stop GR
100 --source include/stop_group_replication.inc
101
102
103 --echo
104 --echo ##############################################################
105 --echo # 4. Verify that the entries corresponding to the instrumented
106 --echo # Gcs_message_data::m_buffer remain in the tables after stopping GR.
107 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/Gcs_message_data::m_buffer';
108 --let $assert_text= 'There should be 1 entry corresponding to the Gcs_message_data::m_buffer in the setup_instruments table after stopping GR'
109 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/Gcs_message_data::m_buffer"
110 --source include/assert.inc
111
112 SELECT EVENT_NAME, CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/Gcs_message_data::m_buffer';
113 --let $assert_text= 'There should be 1 entry corresponding to the Gcs_message_data::m_buffer in the memory_summary_global_by_event_name table after stopping GR'
114 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/Gcs_message_data::m_buffer"
115 --source include/assert.inc
116
117
118 --echo
119 --echo #################################################################
120 --echo # 5. Assert that the number of bytes allocated for
121 --echo # Gcs_message_data::m_buffer event must be 0.
122 --let $assert_text= 'The sum of bytes allocated must be zero after stopping GR'
123 --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/Gcs_message_data::m_buffer"
124 --source include/assert.inc
125
126
127 --echo
128 --echo #################################################################
129 --echo # 6. Cleanup
130 --source include/group_replication_end.inc