File: gr_certification_info_psi_memory.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (98 lines) | stat: -rw-r--r-- 5,123 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
###############################################################################
# This test verifies following for 'certification_info' event name:
# - Verify that entries corresponding to the 'certification_info'
#   performance schema instrumented memory are in the memory table only during
#   the execution of the group replication plugin.
# - Verify that the sum of bytes allocated is greater than zero for a
#   transaction and zero after transaction is finished.
#
# Test:
# 0. The test requires one Server: M1
# 1. Verify that the entries corresponding to the
#    instrumented memory are in the setup instruments
#    table and the memory summary tables.
# 2. Verify that the sum of bytes allocated is greater than
#    zero for a transaction.
# 3. Stop GR.
# 4. Verify that the entries corresponding to the instrumented
#    certification_info remain in the tables after stopping GR.
# 5. Assert that the number of bytes allocated for
#    certification_info event must be 0.
###############################################################################

--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc

--echo
--echo ############################################################
--echo # 1. Verify that the entries corresponding to the
--echo #    instrumented memory are in the setup instruments
--echo #    table and the memory summary tables.
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/certification_info';
--let $assert_text= 'There should be 1 entry corresponding to the certification_info in the setup_instruments table after starting GR'
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/certification_info"
--source include/assert.inc
SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/certification_info';
--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'
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/certification_info"
--source include/assert.inc


--echo
--echo ############################################################
--echo # 2. Verify that the sum of bytes allocated is greater than
--echo #    zero for a transaction.
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=innodb;
SET @@GLOBAL.DEBUG= '+d,group_replication_certifier_after_add_item';
--send INSERT INTO t1 VALUES(1);

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_certifier_after_add_item_reached";

--let $assert_text= 'The sum bytes allocated must be greater than 0'
--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
--source include/assert.inc

SET @@GLOBAL.DEBUG= '-d,group_replication_certifier_after_add_item';
SET DEBUG_SYNC= "now SIGNAL signal.group_replication_certifier_after_add_item_continue";

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--reap

DROP TABLE t1;


--echo
--echo ############################################################
--echo # 3. Stop GR
--source include/stop_group_replication.inc


--echo
--echo ##############################################################
--echo # 4. Verify that the entries corresponding to the instrumented
--echo #    certification_info remain in the tables after stopping GR.
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/certification_info';
--let $assert_text= 'There should be 1 entry corresponding to the certification_info in the setup_instruments table after stopping GR'
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/certification_info"
--source include/assert.inc

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';
--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'
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/certification_info"
--source include/assert.inc


--echo
--echo #################################################################
--echo # 5. Assert that the number of bytes allocated for
--echo #    certification_info event must be 0.
--let $assert_text= 'The sum of bytes allocated must be zero after stopping GR'
--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"
--source include/assert.inc

--echo
--source include/group_replication_end.inc