Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_executed_sets_compatibility.test |
################################################################################ # Test that evaluates the safe guards that stop members from joining with # transactions not present in the group. # # Here we test several cases where the joiner is allowed or not in the group # based on its executed transaction set. # # Test guide: # 0. The test requires three servers. # Test case 1: A member that has an unrelated transaction fails to join # 1) There is a group with a member that has some transactions # 2) Insert a transaction on server 2 that acquires a local GTID # 3) Server 2 fails to join because the group doesn't know that GTID # # Test case 2: A member that has more group transactions fails to join # 1) Take server 1 out of the group. # 2) Clean server 2 and boot the group again with it # 3) Try to add server 1 to the group. It fails because server 1 has 5 # transaction and server 2 only has 1 # # Test case 3: Test case 1 with a forced entry # 1) Stop and clean server 2. # 1) Boot the group with server 1 # 2) Insert a transaction on server 2 that acquires a local GTID # 3) Set the allow_local_disjoint_gtids_join option to 1 in server 2 # 4) Start group replication on server 2, it should succeed. # # Test case 4: Add a member that has the transaction present on member 2 # 1) Insert a transaction on server 3 with the same GTID of that present on 2. # 2) Start group replication on server 3, it should succeed since server 2, a # member of the group knows this transaction. # # 5. Verify all is fine. # # 6. Clean up. ################################################################################ --source include/big_test.inc --let $group_replication_group_name= b2b6cdc0-eb94-11e5-a837-0800200c9a66 --source ../inc/have_group_replication_plugin.inc --let $rpl_gtid_utils= 1 --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 3 --source ../inc/group_replication.inc --let $errand_transaction_uuid= aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa # Suppress errors --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET SESSION sql_log_bin= 0; call mtr.add_suppression(".*This member has more executed transactions *.*"); call mtr.add_suppression(".*The member contains transactions not present *.*"); SET SESSION sql_log_bin= 1; --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET SESSION sql_log_bin= 0; call mtr.add_suppression(".*This member has more executed transactions *.*"); call mtr.add_suppression(".*The member contains transactions not present *.*"); SET SESSION sql_log_bin= 1; --echo # --echo # Setup the first member --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source ../inc/start_and_bootstrap_group_replication.inc # Add some data for recovery CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --let $assert_text= The first member has 3 transaction belonging to the group --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-3"; --source include/assert.inc --echo # --echo # Test case 1: Try to add a member with local data on it. --echo # The start group replication command shall fail --echo # --let $rpl_connection_name= server2 --source include/rpl_connection.inc --eval SET GTID_NEXT= "$errand_transaction_uuid:1" CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET GTID_NEXT= "AUTOMATIC"; --let $assert_text= The member shall contain a local transaction --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1"; --source include/assert.inc --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" --error ER_GROUP_REPLICATION_CONFIGURATION START GROUP_REPLICATION; --echo # Test case 1 cleanup --echo # Remove data on server 2 DROP TABLE t2; RESET MASTER; #For precaution, wait for server 2 to leave --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $group_replication_number_of_members= 1 --source ../inc/gr_wait_for_number_of_members.inc # Wait until View_change_log_event from server 2 join is logged on binary log --let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-4" --source include/wait_condition.inc --echo # --echo # Test case 2: Try to add a member with more group transactions --echo # The start group replication command shall fail --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source ../inc/start_and_bootstrap_group_replication.inc --let $assert_text= The first member to join has only one transaction --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1"; --source include/assert.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $assert_text= The second member to join has 4 transactions --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4"; --source include/assert.inc --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" --error ER_GROUP_REPLICATION_CONFIGURATION START GROUP_REPLICATION; --echo # Test case 2 cleanup --echo # Put server 1 back in the group --let $rpl_connection_name= server2 --source include/rpl_connection.inc #For precaution, wait for server 1 to leave --let $group_replication_number_of_members= 1 --source ../inc/gr_wait_for_number_of_members.inc --source include/stop_group_replication.inc RESET MASTER; --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source ../inc/start_and_bootstrap_group_replication.inc --echo # --echo # Test case 3: Repeat test case 1 again but now force the member to join --echo # The start group replication command shall succeed. --echo # --let $rpl_connection_name= server2 --source include/rpl_connection.inc --eval SET GTID_NEXT= "$errand_transaction_uuid:1" CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET GTID_NEXT= "AUTOMATIC"; --let $assert_text= The member shall contain a local transaction --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1"; --source include/assert.inc SET GLOBAL group_replication_allow_local_disjoint_gtids_join= 1; --source include/start_group_replication.inc --let $assert_text= The joiner shall contain both group and local transactions --let $assert_cond= GTID_IS_EQUAL("[SELECT @@GLOBAL.GTID_EXECUTED]", "$errand_transaction_uuid:1,$group_replication_group_name:1-6") --source include/assert.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $assert_text= The old member shall only contain group transactions --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6"; --source include/assert.inc --echo # --echo # Test case 4: Member 3 joins the group with the same transaction as member 2 --echo # The start group replication command shall succeed without forcing it --echo # --let $rpl_connection_name= server3 --source include/rpl_connection.inc --eval SET GTID_NEXT= "$errand_transaction_uuid:1" CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET GTID_NEXT= "AUTOMATIC"; --let $assert_text= The third member to join has a local transaction --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1"; --source include/assert.inc --source include/start_group_replication.inc --echo # --echo # Verify all is fine --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc INSERT INTO t1 VALUES (2); # We cannot use rpl_sync.inc because of errand transactions. --let $sync_slave_connection= server2 --source include/sync_slave_sql_with_master.inc --let $assert_text= 'There are two values in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2 --source include/assert.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $sync_slave_connection= server3 --source include/sync_slave_sql_with_master.inc --let $assert_text= 'There are two values in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2 --source include/assert.inc --echo # --echo # Cleaning up --echo # --let $rpl_connection_name= server3 --source include/rpl_connection.inc --source include/stop_group_replication.inc DROP TABLE t3; DROP TABLE t1; RESET MASTER; --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET GLOBAL group_replication_allow_local_disjoint_gtids_join= 0; --source include/stop_group_replication.inc DROP TABLE t2; DROP TABLE t1; RESET MASTER; --let $rpl_connection_name= server1 --source include/rpl_connection.inc DROP TABLE t1; --source ../inc/group_replication_end.inc