Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test verifies following for 'group_member_info' event name:
3 # - Verify that entries corresponding to the 'group_member_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 zero.
15 # 3. Stop GR.
16 # 4. Verify that the entries corresponding to the instrumented
17 # group_member_info remain in the tables after uninstalling GR.
18 # 5. Assert that the number of bytes allocated for
19 # group_member_info event must be 0.
20 # 6. Clean up.
21 ###############################################################################
22
23 --source include/have_group_replication_plugin.inc
24 --let $rpl_skip_group_replication_start= 1
25 --source include/group_replication.inc
26 --source include/start_and_bootstrap_group_replication.inc
27
28
29 --echo
30 --echo ############################################################
31 --echo # 1. Verify that the entries corresponding to the
32 --echo # instrumented memory are in the setup instruments
33 --echo # table and the memory summary tables.
34 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/group_member_info';
35 --let $assert_text= 'There should be 1 entry corresponding to the group_member_info in the setup_instruments table after starting GR'
36 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/group_member_info"
37 --source include/assert.inc
38 SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/group_member_info';
39 --let $assert_text= 'There should be 1 entry corresponding to the group_member_info in the memory_summary_global_by_event_name table after starting GR'
40 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/group_member_info"
41 --source include/assert.inc
42
43
44 --echo
45 --echo ############################################################
46 --echo # 2. Verify that the sum of bytes allocated is greater than
47 --echo # zero.
48 --let $assert_text= 'The sum bytes allocated must be greater than 0'
49 --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/group_member_info"] > 0
50 --source include/assert.inc
51
52
53 --echo
54 --echo ############################################################
55 --echo # 3. Stop GR
56 --source include/stop_group_replication.inc
57 --source include/uninstall_group_replication_plugin.inc
58
59
60 --echo
61 --echo ##############################################################
62 --echo # 4. Verify that the entries corresponding to the instrumented
63 --echo # group_member_info remain in the tables after uninstalling GR.
64 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/group_member_info';
65 --let $assert_text= 'There should be 1 entry corresponding to the group_member_info in the setup_instruments table after uninstalling GR'
66 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/group_member_info"
67 --source include/assert.inc
68
69 SELECT EVENT_NAME, CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/group_member_info';
70 --let $assert_text= 'There should be 1 entry corresponding to the group_member_info in the memory_summary_global_by_event_name table after uninstalling GR'
71 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/group_member_info"
72 --source include/assert.inc
73
74
75 --echo
76 --echo #################################################################
77 --echo # 5. Assert that the number of bytes allocated for
78 --echo # group_member_info event must be 0.
79 --let $assert_text= 'The sum of bytes allocated must be zero after uninstalling GR'
80 --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/group_member_info"
81 --source include/assert.inc
82
83 --echo
84 --echo #################################################################
85 --echo # 6. Clean up.
86 --source include/install_group_replication_plugin.inc
87 --source include/group_replication_end.inc