Debian Codegraph @

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

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