Debian Codegraph @

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

raw
1 ########################################################################
2 # This test verifies following for 'message_service_queue' event name:
3 # - Verify that entries corresponding to the 'message_service_queue'
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 # transmitted tag and message over GR send service and zero after its
8 # finished.
9 #
10 # Test:
11 # 0. This test requires one server with GR
12 # 1. Verify that the entries corresponding to the
13 # instrumented memory are in the setup instruments
14 # table and the memory summary tables.
15 # 2. Load plugin replication observers example on server1
16 # 3. Verify that the sum of bytes allocated is greater than
17 # zero for the transmitted tag and message over GR send
18 # service.
19 # 4. Assert server1 received messages transmitted by GR message
20 # delivery
21 # 5. Verify that the entries corresponding to the instrumented
22 # message_service_queue remain in the tables after stopping GR.
23 # 6. Assert that the number of bytes allocated for
24 # message_service_queue event must be 0.
25 # 7. Cleanup
26 ########################################################################
27
28 --source include/have_debug_sync.inc
29 --source include/have_replication_observers_example_plugin.inc
30 --source include/have_group_replication_plugin.inc
31 --let $rpl_skip_group_replication_start= 1
32 --source include/group_replication.inc
33
34
35 --echo
36 --echo ############################################################
37 --echo # 1. Verify that the entries corresponding to the
38 --echo # instrumented memory are in the setup instruments
39 --echo # table and the memory summary tables.
40 SET @@GLOBAL.DEBUG= '+d,group_replication_message_service_dispatcher_before_pop';
41 --source include/start_and_bootstrap_group_replication.inc
42
43 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/message_service_queue';
44 --let $assert_text= 'There should be 1 entry corresponding to the message_service_queue in the setup_instruments table after starting GR'
45 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/message_service_queue"
46 --source include/assert.inc
47
48 SELECT EVENT_NAME FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/message_service_queue';
49 --let $assert_text= 'There should be 1 entry corresponding to the message_service_queue in the memory_summary_global_by_event_name table after starting GR'
50 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/message_service_queue"
51 --source include/assert.inc
52
53
54 --echo
55 --echo ############################################################
56 --echo # 2. Load plugin replication observers example on server1
57 --source include/install_replication_observers_example.inc
58
59 --echo
60 --echo ############################################################
61 --echo # 3. Verify that the sum of bytes allocated is greater than
62 --echo # zero for the transmitted tag and message over GR send
63 --echo # service.
64 --let $tag= `SELECT UUID()`
65 --replace_result $tag TAG
66 --eval SELECT group_replication_service_message_send("$tag", repeat('a',1024*1024))
67
68 --let $rpl_connection_name= server_1
69 --source include/rpl_connection.inc
70 SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_message_service_dispatcher_before_pop_reached";
71
72 --let $assert_text= 'The sum bytes allocated must be greater than 0'
73 --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/message_service_queue"] > 0
74 --source include/assert.inc
75
76 SET @@GLOBAL.DEBUG= '-d,group_replication_message_service_dispatcher_before_pop';
77 SET DEBUG_SYNC= "now SIGNAL signal.group_replication_message_service_dispatcher_before_pop_continue";
78
79
80 --echo
81 --echo ############################################################
82 --echo # 4. Assert server1 received messages transmitted by GR message
83 --echo # delivery
84 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.error_log WHERE error_code='MY-011071' AND data LIKE '%Service message recv TAG: "$tag"%'
85 --source include/wait_condition.inc
86
87
88 --echo
89 --echo ##############################################################
90 --echo # 5. Verify that the entries corresponding to the instrumented
91 --echo # message_service_queue remain in the tables after stopping GR.
92 --source include/stop_group_replication.inc
93
94 SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE 'memory/group_rpl/message_service_queue';
95 --let $assert_text= 'There should be 1 entry corresponding to the message_service_queue in the setup_instruments table after stopping GR'
96 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.setup_instruments WHERE NAME LIKE "memory/group_rpl/message_service_queue"
97 --source include/assert.inc
98
99 SELECT EVENT_NAME, CURRENT_NUMBER_OF_BYTES_USED FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/message_service_queue';
100 --let $assert_text= 'There should be 1 entry corresponding to the message_service_queue in the memory_summary_global_by_event_name table after stopping GR'
101 --let $assert_cond= COUNT(*) = 1 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE "memory/group_rpl/message_service_queue"
102 --source include/assert.inc
103
104
105 --echo
106 --echo #################################################################
107 --echo # 6. Assert that the number of bytes allocated for
108 --echo # message_service_queue event must be 0.
109 --let $assert_text= 'The sum of bytes allocated must be zero after stopping GR'
110 --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/message_service_queue"
111 --source include/assert.inc
112
113
114 --echo
115 --echo #################################################################
116 --echo # 7. Cleanup
117 --source include/uninstall_replication_observers_example.inc
118 --source include/group_replication_end.inc