| 1 |
######################################################################## |
| 2 |
# |
| 3 |
# This test validate that all servers that register the recv service |
| 4 |
# shall receive the messages sent by send service. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. This test requires two servers with GR |
| 8 |
# 1. Load plugin replication observers example on server1 |
| 9 |
# 2. Load plugin replication observers example on server2 |
| 10 |
# 3. Execute UDF that will transmit tag and message over GR send service |
| 11 |
# 4. On server 1 execute UDF that will transmit tag and message over GR |
| 12 |
# send service |
| 13 |
# 5. To decrease failure rate on assert_grep we do a transaction with |
| 14 |
# AFTER consistency to add some rounds on GCS communication and stop GR on |
| 15 |
# server1, which will make it wait for the delivery of new view, and |
| 16 |
# that will happen only after delivery of service message. This will |
| 17 |
# give some time to server to receive and write it to error log. |
| 18 |
# 6. Assert server1 received both messages transmitted by GR message |
| 19 |
# delivery |
| 20 |
# 7. Assert server2 received both messages transmitted by GR message |
| 21 |
# delivery |
| 22 |
# 8. Cleanup |
| 23 |
# |
| 24 |
######################################################################## |
| 25 |
|
| 26 |
--source include/have_replication_observers_example_plugin.inc |
| 27 |
--source include/have_group_replication_plugin.inc |
| 28 |
--source include/group_replication.inc |
| 29 |
|
| 30 |
--echo |
| 31 |
--echo # 1. Load plugin replication observers example on server1 |
| 32 |
|
| 33 |
--source include/install_replication_observers_example.inc |
| 34 |
|
| 35 |
--echo |
| 36 |
--echo # 2. Load plugin replication observers example on server2 |
| 37 |
|
| 38 |
--let $rpl_connection_name= server2 |
| 39 |
--source include/rpl_connection.inc |
| 40 |
|
| 41 |
--source include/install_replication_observers_example.inc |
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # 3. Execute UDF that will transmit tag and message over GR send service |
| 45 |
|
| 46 |
SELECT group_replication_service_message_send("tag", "Server2 sent a message"); |
| 47 |
|
| 48 |
--echo |
| 49 |
--echo # 4. On server 1 execute UDF that will transmit tag and message over GR |
| 50 |
--echo # send service |
| 51 |
|
| 52 |
--let $rpl_connection_name= server1 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
|
| 55 |
SELECT group_replication_service_message_send("tag", "Server1 sent a message"); |
| 56 |
|
| 57 |
--echo |
| 58 |
--echo # 5. To decrease failure rate on assert_grep we do a transaction with |
| 59 |
--echo # AFTER consistency to add some rounds on GCS communication and stop GR on |
| 60 |
--echo # server1, which will make it wait for the delivery of new view, and |
| 61 |
--echo # that will happen only after delivery of service message. This will |
| 62 |
--echo # give some time to server to receive and write it to error log. |
| 63 |
|
| 64 |
SET @@SESSION.group_replication_consistency= 'AFTER'; |
| 65 |
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY , b INT); |
| 66 |
DROP TABLE test.t1; |
| 67 |
--source include/stop_group_replication.inc |
| 68 |
|
| 69 |
--echo |
| 70 |
--echo # 6. Assert server1 received both messages transmitted by GR message |
| 71 |
--echo # delivery |
| 72 |
|
| 73 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service.1.err |
| 74 |
--let $assert_count = 1 |
| 75 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server2 sent a message", MSG_SIZE: 22.' |
| 76 |
--let $assert_text = Server 1 received message from server 2. |
| 77 |
--source include/assert_grep.inc |
| 78 |
|
| 79 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service.1.err |
| 80 |
--let $assert_count = 1 |
| 81 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server1 sent a message", MSG_SIZE: 22.' |
| 82 |
--let $assert_text = Server 1 received message from itself. |
| 83 |
--source include/assert_grep.inc |
| 84 |
|
| 85 |
--echo |
| 86 |
--echo # 7. Assert server2 received both messages transmitted by GR message |
| 87 |
--echo # delivery |
| 88 |
|
| 89 |
--let $rpl_connection_name= server2 |
| 90 |
--source include/rpl_connection.inc |
| 91 |
|
| 92 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service.2.err |
| 93 |
--let $assert_count = 1 |
| 94 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server2 sent a message", MSG_SIZE: 22.' |
| 95 |
--let $assert_text = Server 2 received message from itself. |
| 96 |
--source include/assert_grep.inc |
| 97 |
|
| 98 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_message_service.2.err |
| 99 |
--let $assert_count = 1 |
| 100 |
--let $assert_select = Plugin replication_observers_example reported: 'Service message recv TAG: "tag", TAG_SIZE: 3, MSG: "Server1 sent a message", MSG_SIZE: 22.' |
| 101 |
--let $assert_text = Server 2 received message from server 1. |
| 102 |
--source include/assert_grep.inc |
| 103 |
|
| 104 |
--echo |
| 105 |
--echo # 8. Cleanup |
| 106 |
|
| 107 |
--source include/uninstall_replication_observers_example.inc |
| 108 |
|
| 109 |
--let $rpl_connection_name= server1 |
| 110 |
--source include/rpl_connection.inc |
| 111 |
|
| 112 |
--source include/start_group_replication.inc |
| 113 |
|
| 114 |
--source include/uninstall_replication_observers_example.inc |
| 115 |
|
| 116 |
--source include/group_replication_end.inc |