File: gr_consistent_transactions_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 (115 lines) | stat: -rw-r--r-- 5,568 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
###############################################################################
# This test verifies following for 'consistent_transactions'
# event name:
# - Verify that entries corresponding to the
#   'consistent_transactions' 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.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Verify that the entries corresponding to the
#    instrumented memory are in the setup instruments
#    table and the memory summary tables for the event
#    consistent_transactions.
# 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
#    consistent_transactions remain in the tables after stopping GR.
# 5. Assert that the number of bytes allocated for consistent_transactions
#    event must be 0.
# 6. Clean up.
###############################################################################

--source include/big_test.inc
--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 for the event
--echo #    consistent_transactions.
SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/consistent_transactions';
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions in the setup_instruments table after starting GR'
--let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/consistent_transactions"
--source include/assert.inc

SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/consistent_transactions';
--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions 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/consistent_transactions"
--source include/assert.inc


--echo
--echo ############################################################
--echo # 2. Verify that the sum of bytes allocated is greater than
--echo #    zero for a transaction.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=innodb;
SET @@SESSION.group_replication_consistency= AFTER;
SET @@GLOBAL.DEBUG= '+d,group_replication_consistency_manager_after_certification';
--send INSERT INTO t1 VALUES(1);

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_consistency_manager_after_certification_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/consistent_transactions"] > 0
--source include/assert.inc

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


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

DROP TABLE t1;


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


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

--let $assert_text= 'There should be 1 entry corresponding to the consistent_transactions 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/consistent_transactions"
--source include/assert.inc


--echo
--echo #################################################################
--echo # 5. Assert that the number of bytes allocated for
--echo #    consistent_transactions 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/consistent_transactions"
--source include/assert.inc


--echo
--echo #################################################################
--echo # 6. Clean up.
--source include/install_group_replication_plugin.inc
--source include/group_replication_end.inc