| 1 |
################################################################################ |
| 2 |
# This test verifies that when a server with higher major version tries to |
| 3 |
# join the group, its compatibility type is set to READ_COMPATIBLE. As such |
| 4 |
# that node can only be a part of the group in READ ONLY mode and cannot |
| 5 |
# execute any writes. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. The test requires three servers: M1, M2 and M3. |
| 9 |
# 1. Bootstrap start a group on M1. Start GR on M2. Check both are running. |
| 10 |
# 2. Set DEBUG point in M3 to ensure that the major version of that node is |
| 11 |
# higher than that of the group. |
| 12 |
# - Start GR on M3. It should be able to join the group but in read only mode. |
| 13 |
# - Try executing DDL (create table) on M3. It must fail. |
| 14 |
# 3. Stop GR on M3. The server's super_read_only mode should be 0 now. |
| 15 |
# - Try executing DDL (create table) on M3. It must succeed. |
| 16 |
# 4. Clean up. |
| 17 |
################################################################################ |
| 18 |
|
| 19 |
--source include/big_test.inc |
| 20 |
--source include/have_debug.inc |
| 21 |
--let $group_replication_group_name= 5e3c00e0-8f04-11e5-a837-0800200c9a66 |
| 22 |
--source include/have_group_replication_plugin.inc |
| 23 |
--let $rpl_skip_group_replication_start= 1 |
| 24 |
--let $rpl_server_count= 3 |
| 25 |
--source include/group_replication.inc |
| 26 |
|
| 27 |
--echo |
| 28 |
--echo # Start group_replication on the first two nodes and check if the group |
| 29 |
--echo # of two members is running. |
| 30 |
|
| 31 |
--connection server1 |
| 32 |
--source include/start_and_bootstrap_group_replication.inc |
| 33 |
|
| 34 |
--connection server2 |
| 35 |
--source include/start_group_replication.inc |
| 36 |
|
| 37 |
--let $group_replication_number_of_members= 2 |
| 38 |
--source include/gr_wait_for_number_of_members.inc |
| 39 |
|
| 40 |
--echo # Add the debug point on the third member to ensure that the major |
| 41 |
--echo # version of that node is higher than that of the group. It should be able to |
| 42 |
--echo # join the group but in read only mode. |
| 43 |
|
| 44 |
--connection server3 |
| 45 |
SET @debug_saved= @@GLOBAL.DEBUG; |
| 46 |
# Cause the member to broadcast and compare himself using a higher version |
| 47 |
SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_higher_major_version'; |
| 48 |
SET SESSION sql_log_bin=0; |
| 49 |
call mtr.add_suppression("Member version is read compatible with the group."); |
| 50 |
SET SESSION sql_log_bin=1; |
| 51 |
|
| 52 |
--source include/start_group_replication.inc |
| 53 |
|
| 54 |
--let $group_replication_number_of_members= 3 |
| 55 |
--source include/gr_wait_for_number_of_members.inc |
| 56 |
|
| 57 |
--echo # Verify that the server 3 joining the group is in super_read_only mode |
| 58 |
--echo # and cannot execute writes. |
| 59 |
|
| 60 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 61 |
CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL); |
| 62 |
|
| 63 |
--connection server3 |
| 64 |
--source include/stop_group_replication.inc |
| 65 |
SET @@GLOBAL.DEBUG= @debug_saved; |
| 66 |
|
| 67 |
--echo # The server's super_read_only mode should be 0 here. |
| 68 |
--let $assert_text= The super_read_only mode should be 0 here. |
| 69 |
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0; |
| 70 |
--source include/assert.inc |
| 71 |
|
| 72 |
#The create table now works |
| 73 |
CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL); |
| 74 |
|
| 75 |
#Drop the table and reset the server allowing a clean test exit |
| 76 |
DROP TABLE t1; |
| 77 |
RESET MASTER; |
| 78 |
|
| 79 |
--source include/group_replication_end.inc |