| 1 |
######################################################################## |
| 2 |
# |
| 3 |
# The receiver service queue all messages and deliver to subscribers |
| 4 |
# on a dedicated thread, thence not holding the Group Communication |
| 5 |
# Service deliver thread. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. This test requires two servers with GR |
| 9 |
# 1. Load plugin replication observers example on server1 |
| 10 |
# 2. Load plugin replication observers example on server2 |
| 11 |
# 3. Enable debug point that will put on hold the notification of recv |
| 12 |
# messages |
| 13 |
# 4. Execute UDF that will transmit tag and message over GR send service |
| 14 |
# 5. On server 1 execute UDF that will transmit tag and message over GR |
| 15 |
# send service |
| 16 |
# 6. To decrease failure rate on assert_grep we do a transaction with |
| 17 |
# AFTER consistency to add some rounds on GCS communication and stop GR on |
| 18 |
# server1, which will make it wait for the delivery of new view, and |
| 19 |
# that will happen only after delivery of service message. This will |
| 20 |
# give some time to server to receive and write it to error log. |
| 21 |
# 7. Assert server1 received both messages transmitted by GR delivery |
| 22 |
# message service |
| 23 |
# 8. Assert server2 did not received any message transmitted by GR delivery |
| 24 |
# message service due being held on debug point |
| 25 |
# 9. Assert server2 received view from server1 leaving the group |
| 26 |
# 10. Remove debug point and release hold of messages |
| 27 |
# 11. Assert server2 received both messages transmitted by GR message |
| 28 |
# delivery |
| 29 |
# 12. Cleanup |
| 30 |
# |
| 31 |
######################################################################## |
| 32 |
|
| 33 |
--source include/have_debug_sync.inc |
| 34 |
--source include/have_replication_observers_example_plugin.inc |
| 35 |
--source include/have_group_replication_plugin.inc |
| 36 |
--source include/group_replication.inc |
| 37 |
|
| 38 |
--echo |
| 39 |
--echo # 1. Load plugin replication observers example on server1 |
| 40 |
|
| 41 |
--source include/install_replication_observers_example.inc |
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # 2. Load plugin replication observers example on server2 |
| 45 |
|
| 46 |
--let $rpl_connection_name= server2 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
|
| 49 |
--source include/install_replication_observers_example.inc |
| 50 |
|
| 51 |
--echo |
| 52 |
--echo # 3. Enable debug point that will put on hold the notification of recv |
| 53 |
--echo # messages |
| 54 |
|
| 55 |
--let $debug_point= group_replication_message_service_hold_messages |
| 56 |
--source include/add_debug_point.inc |
| 57 |
|
| 58 |
--echo |
| 59 |
--echo # 4. Execute UDF that will transmit tag and message over GR send service |
| 60 |
|
| 61 |
SELECT group_replication_service_message_send("tag", "Server2 sent a message"); |
| 62 |
|
| 63 |
--echo |
| 64 |
--echo # 5. On server 1 execute UDF that will transmit tag and message over GR |
| 65 |
--echo # send service |
| 66 |
|
| 67 |
--let $rpl_connection_name= server1 |
| 68 |
--source include/rpl_connection.inc |
| 69 |
|
| 70 |
SELECT group_replication_service_message_send("tag", "Server1 sent a message"); |
| 71 |
|
| 72 |
--echo |
| 73 |
--echo # 6. To decrease failure rate on assert_grep we do a transaction with |
| 74 |
--echo # AFTER consistency to add some rounds on GCS communication and stop GR on |
| 75 |
--echo # server1, which will make it wait for the delivery of new view, and |
| 76 |
--echo # that will happen only after delivery of service message. This will |
| 77 |
--echo # give some time to server to receive and write it to error log. |
| 78 |
|
| 79 |
SET @@SESSION.group_replication_consistency= 'AFTER'; |
| 80 |
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY , b INT); |
| 81 |
DROP TABLE test.t1; |
| 82 |
--source include/stop_group_replication.inc |
| 83 |
|
| 84 |
--echo |
| 85 |
--echo # 7. Assert server1 received both messages transmitted by GR delivery |
| 86 |
--echo # message service |
| 87 |
|
| 88 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service_queue_messages.1.err |
| 89 |
--let $assert_count = 1 |
| 90 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server2 sent a message", MSG_SIZE: 22.' |
| 91 |
--let $assert_text = Server 1 received message from server 2. |
| 92 |
--source include/assert_grep.inc |
| 93 |
|
| 94 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service_queue_messages.1.err |
| 95 |
--let $assert_count = 1 |
| 96 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server1 sent a message", MSG_SIZE: 22.' |
| 97 |
--let $assert_text = Server 1 received message from itself. |
| 98 |
--source include/assert_grep.inc |
| 99 |
|
| 100 |
--echo |
| 101 |
--echo # 8. Assert server2 did not received any message transmitted by GR delivery |
| 102 |
--echo # message service due being held on debug point |
| 103 |
|
| 104 |
--let $rpl_connection_name= server2 |
| 105 |
--source include/rpl_connection.inc |
| 106 |
|
| 107 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service_queue_messages.2.err |
| 108 |
--let $assert_count = 0 |
| 109 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv *' |
| 110 |
--let $assert_text = Server 2 did not received any message. |
| 111 |
--source include/assert_grep.inc |
| 112 |
|
| 113 |
--echo |
| 114 |
--echo # 9. Assert server2 received view from server1 leaving the group |
| 115 |
|
| 116 |
--let $raw_view_id= query_get_value(SELECT view_id FROM performance_schema.replication_group_member_stats, view_id, 1) |
| 117 |
--let $view_id= `SELECT RIGHT('$raw_view_id', 1)` |
| 118 |
--let $assert_text= Server2 received view from server1 leaving the group |
| 119 |
--let $assert_cond= $view_id = 3 |
| 120 |
--source include/assert.inc |
| 121 |
|
| 122 |
--echo |
| 123 |
--echo # 10. Remove debug point and release hold of messages |
| 124 |
|
| 125 |
--let $debug_point= group_replication_message_service_hold_messages |
| 126 |
--source include/remove_debug_point.inc |
| 127 |
|
| 128 |
SET DEBUG_SYNC= "now SIGNAL signal.notification_continue"; |
| 129 |
|
| 130 |
--echo |
| 131 |
--echo # 11. Assert server2 received both messages transmitted by GR message |
| 132 |
--echo # delivery |
| 133 |
|
| 134 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service_queue_messages.2.err |
| 135 |
--let $assert_count = 1 |
| 136 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server2 sent a message", MSG_SIZE: 22.' |
| 137 |
--let $assert_text = Server 2 received message from itself. |
| 138 |
--source include/assert_grep.inc |
| 139 |
|
| 140 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service_queue_messages.2.err |
| 141 |
--let $assert_count = 1 |
| 142 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server1 sent a message", MSG_SIZE: 22.' |
| 143 |
--let $assert_text = Server 2 received message from server 1. |
| 144 |
--source include/assert_grep.inc |
| 145 |
|
| 146 |
--echo |
| 147 |
--echo # 12. Cleanup |
| 148 |
|
| 149 |
--source include/uninstall_replication_observers_example.inc |
| 150 |
|
| 151 |
--let $rpl_connection_name= server1 |
| 152 |
--source include/rpl_connection.inc |
| 153 |
|
| 154 |
--source include/start_group_replication.inc |
| 155 |
|
| 156 |
--source include/uninstall_replication_observers_example.inc |
| 157 |
|
| 158 |
--source include/group_replication_end.inc |