| 1 |
################################################################################ |
| 2 |
# BUG#22045032 - SQL_THREAD OF BINLOG-LESS SLAVE FAILS WITHOUT ANY MESSAGE FOR |
| 3 |
# VIEW_CHANGE EVENT |
| 4 |
# |
| 5 |
# This test verifies that the slave server with binlog disabled is able to |
| 6 |
# skip the view change events when replicating from a member which is part of |
| 7 |
# a Group. |
| 8 |
# |
| 9 |
# Bug#24754462 - ADD MTR TEST RELATED TO MYSQLBINLOG IN GR |
| 10 |
# This test also checks replaying of mysqlbinlog output of GR member on a |
| 11 |
# binlog-less server and verifies that binlogless server cannot be added to |
| 12 |
# the GR group. |
| 13 |
# |
| 14 |
# Test: |
| 15 |
# 0. The test requires three servers: M1, M2 and M3. |
| 16 |
# 1. Bootstrap start a group on M1. Start GR on M2 and add some data. |
| 17 |
# 2. Connect the third server to one of the member of the group, establishing |
| 18 |
# an asynchronous replication connection (M1->M3). Start slave on M3. |
| 19 |
# 3. On the slave (M3), test that the data is properly replicated after the |
| 20 |
# start slave is completed. Diff check the table on M1 and M3. |
| 21 |
# 4. Verify if the available backup (binlog file) can be later restored |
| 22 |
# successfully on a binlogless-server. |
| 23 |
# 5. Verify if binlogless-server cannot be added to the GR group |
| 24 |
# 6. Ensure that the test is cleaned up and closed. |
| 25 |
################################################################################ |
| 26 |
|
| 27 |
--source include/have_group_replication_plugin.inc |
| 28 |
--let $rpl_skip_group_replication_start= 1 |
| 29 |
--let $rpl_server_count= 4 |
| 30 |
--source include/group_replication.inc |
| 31 |
|
| 32 |
# Start the first member here |
| 33 |
--let $rpl_connection_name= server1 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
--source include/start_and_bootstrap_group_replication.inc |
| 36 |
|
| 37 |
# Start the second node. Add some data and sync it in the group. |
| 38 |
--let $rpl_connection_name= server2 |
| 39 |
--source include/rpl_connection.inc |
| 40 |
--source include/start_group_replication.inc |
| 41 |
CREATE TABLE t1 (i INT PRIMARY KEY); |
| 42 |
INSERT INTO t1 VALUES(1); |
| 43 |
--source include/rpl_sync.inc |
| 44 |
|
| 45 |
# Establish an async connection between the third server and member 1 of |
| 46 |
# the group. |
| 47 |
--let $rpl_connection_name= server3 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
|
| 50 |
SET SESSION sql_log_bin=0; |
| 51 |
call mtr.add_suppression("You need to use --log-bin to make"); |
| 52 |
SET SESSION sql_log_bin=1; |
| 53 |
|
| 54 |
# Make this server the slave of the first server which belongs to the group. |
| 55 |
--disable_warnings |
| 56 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 57 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='root' |
| 58 |
--enable_warnings |
| 59 |
|
| 60 |
--source include/start_slave.inc |
| 61 |
|
| 62 |
--let $rpl_connection_name= server1 |
| 63 |
--source include/rpl_connection.inc |
| 64 |
|
| 65 |
--let $sync_slave_connection= server3 |
| 66 |
--source include/sync_slave_sql_with_master.inc |
| 67 |
|
| 68 |
--echo # On the slave (server3), test that the data is properly replicated |
| 69 |
--echo # after the start slave is complete. |
| 70 |
--let $diff_tables= server1:test.t1, server3:test.t1 |
| 71 |
--source include/diff_tables.inc |
| 72 |
|
| 73 |
--echo |
| 74 |
--let $rpl_connection_name= server2 |
| 75 |
--source include/rpl_connection.inc |
| 76 |
|
| 77 |
# Get the binlog file |
| 78 |
--let $server2_datadir= `SELECT @@DATADIR` |
| 79 |
--let $server2_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 80 |
|
| 81 |
--echo |
| 82 |
--let $rpl_connection_name= server4 |
| 83 |
--source include/rpl_connection.inc |
| 84 |
# Restore the backup onto a server outside the GR group |
| 85 |
set sql_log_bin=0; |
| 86 |
call mtr.add_suppression("\\[ERROR\\] \\[MY-[^]]*\\] \\[Repl\\] Plugin group_replication reported: 'Binlog must be enabled for Group Replication'"); |
| 87 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work."); |
| 88 |
set sql_log_bin=1; |
| 89 |
|
| 90 |
# Setting the arguments to connect to server4 |
| 91 |
--let $server4_connection_args= --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_4 |
| 92 |
# Restoring the backup file on server4 using mysqlbinlog client and the connection arguments set above |
| 93 |
--exec $MYSQL_BINLOG $server2_datadir/$server2_binlog_file | $MYSQL $server4_connection_args |
| 94 |
|
| 95 |
# See if the data has been properly restored on server4 |
| 96 |
--echo # check that t1 exists and has same values in all servers |
| 97 |
--let $diff_tables=server1:test.t1 ,server2:test.t1 ,server3:test.t1 ,server4:test.t1 |
| 98 |
--source include/diff_tables.inc |
| 99 |
|
| 100 |
# Add server4 to GR group |
| 101 |
# This operation will fail as binlog is disabled in server4 |
| 102 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 103 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 104 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 105 |
START GROUP_REPLICATION; |
| 106 |
|
| 107 |
# Drop table |
| 108 |
DROP TABLE t1; |
| 109 |
|
| 110 |
--let $rpl_connection_name= server1 |
| 111 |
--source include/rpl_connection.inc |
| 112 |
DROP TABLE t1; |
| 113 |
|
| 114 |
--let $sync_slave_connection= server3 |
| 115 |
--source include/sync_slave_sql_with_master.inc |
| 116 |
--let $rpl_connection_name= server3 |
| 117 |
--source include/rpl_connection.inc |
| 118 |
|
| 119 |
--source include/stop_slave.inc |
| 120 |
--source include/rpl_reset_slave.inc |
| 121 |
|
| 122 |
--source include/group_replication_end.inc |