Debian Codegraph @

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

raw
1 ###############################################################################
2 # Verify that entries corresponding to the XCOM performance schema instrumented
3 # memory are in the memory table only during the execution of the
4 # group replication plugin.
5 #
6 # Test:
7 # 0. The test requires one Server: M1
8 # 1. Verify that the entries corresponding to the instrumented GCS memory are
9 # in the setup_instruments and memory summary tables.
10 # 2. Verify that the sum of memory allocated is greater than the sum of memory
11 # deallocated after starting GR.
12 # 3. Stop GR.
13 # 4. Verify that the entries corresponding to the instrumented GCS memory
14 # remain in the tables.
15 # 5. Verify that all data allocated has been deallocated.
16 ###############################################################################
17
18 --source include/have_group_replication_plugin.inc
19 --source include/group_replication.inc
20
21 --echo
22 --echo ############################################################
23 --echo # 1. Verify that the entries corresponding to the
24 --echo # instrumented memory are in the setup instruments
25 --echo # table and the memory summary tables.
26 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE '%GCS_XCom::xcom_cache%';
27 --let $assert_text= 'There should be 1 entry corresponding to the XCom cache in the setup_instruments table after starting GR'
28 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "%GCS_XCom::xcom_cache%"
29 --source include/assert.inc
30 SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE '%GCS_XCom::xcom_cache%';
31 --let $assert_text= 'There should be 1 entry corresponding to the XCom cache in the memory_summary_global_by_event_name table after starting GR'
32 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "%GCS_XCom::xcom_cache%"
33 --source include/assert.inc
34 --echo
35 --echo ############################################################
36 --echo # 2. Verify that the sum of bytes allocated is greater than
37 --echo # the sum of bytes deallocated.
38 --let $assert_text= 'The sum bytes allocated must be equal to or greater than the sum of bytes deallocated'
39 --let $assert_cond= [SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "%GCS_XCom::xcom_cache%"] > 0
40 --source include/assert.inc
41 --echo
42 --echo ############################################################
43 --echo # 3. Stop GR
44 --source include/stop_group_replication.inc
45
46 --echo
47 --echo ##############################################################
48 --echo # 4. Verify that the entries corresponding to the instrumented
49 --echo # GCS memory remain in the tables after stopping GR.
50 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE '%GCS_XCom::xcom_cache%';
51 --let $assert_text= 'There should be 1 entry corresponding to the XCom cache in the setup_instruments table after stopping GR'
52 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "%GCS_XCom::xcom_cache%"
53 --source include/assert.inc
54 SELECT EVENT_NAME, CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE '%GCS_XCom::xcom_cache%';
55 --let $assert_text= 'There should be 1 entry corresponding to the XCom cache in the memory_summary_global_by_event_name table after stopping GR'
56 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "%GCS_XCom::xcom_cache%"
57 --source include/assert.inc
58
59 --echo
60 --echo #################################################################
61 --echo # 5. Assert that the number of bytes allocated is the same as the
62 --echo # number of bytes deallocated after stopping GR.
63 --let $assert_text= 'The sum of bytes allocated must be equal to the sum of bytes deallocated after stopping GR'
64 --let $assert_cond= [SELECT CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "%GCS_XCom::xcom_cache%"] = 0
65 --source include/assert.inc
66 --echo
67 --source include/group_replication_end.inc