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_transaction_compatibility_basics.test |
################################################################################ # Test that evaluates basics about transaction control when joining and the # basics about group_replication_allow_local_disjoint_gtids_join. # # Test: # 0) The test requires two servers: M1 and M2. # 1) Bootstrap start a group on M1 and execute some transactions. # 2) Execute a local transaction on M2 and try to join. It fails. # Verify the error messages are logged. # 3) Test the default value is 0, invalid inputs are not accepted, and the # value can be set to 1 for the variable. # 4) Test that the M2 can now join the group with this option set to 1/ON. # 5) Verify all is fine. Check data in table on M2. # 6) Clean up. ################################################################################ --let $group_replication_group_name= c645abc0-ebb9-11e5-a837-0800200c9a66 --source ../inc/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source ../inc/group_replication.inc --let $errand_transaction_uuid= aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa # Suppress errors --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 # Verify that server 2 can't enter the group --echo # Verify that error messages are logged. --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; --replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* *\[/DATE_TIME [/ --let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_transaction_compatibility_basics.err --let $grep_pattern=This member has more executed transactions than those present in the group. Local transactions --source include/grep_pattern.inc --replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* *\[/DATE_TIME [/ --let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_transaction_compatibility_basics.err --let $grep_pattern=The member contains transactions not present in the group. The member will now exit the group. --source include/grep_pattern.inc --echo # --echo # Test the basics for group_replication_allow_local_disjoint_gtids_join --echo # # Check default value --let $assert_text= The default value of allow_local_disjoint_gtids_join should be 0/OFF --let $assert_cond= "[SELECT @@group_replication_allow_local_disjoint_gtids_join]" = "0" --source include/assert.inc # Test that variable doesn't take invalid inputs --error ER_WRONG_VALUE_FOR_VAR SET GLOBAL group_replication_allow_local_disjoint_gtids_join= NULL; --error ER_WRONG_VALUE_FOR_VAR SET GLOBAL group_replication_allow_local_disjoint_gtids_join= "a"; --error ER_WRONG_TYPE_FOR_VAR SET GLOBAL group_replication_allow_local_disjoint_gtids_join= 1.2; # Enable variable by setting it to 1 SET GLOBAL group_replication_allow_local_disjoint_gtids_join= 1; --let $assert_text= The value of allow_local_disjoint_gtids_join should now be 1/ON --let $assert_cond= "[SELECT @@group_replication_allow_local_disjoint_gtids_join]" = "1" --source include/assert.inc --echo # --echo # Test that server 2 can now join --echo # #For precaution, wait for server 2 to leave before joining again. --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 --let $rpl_connection_name= server2 --source include/rpl_connection.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 --echo # --echo # Cleaning up --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --source include/start_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET GLOBAL group_replication_allow_local_disjoint_gtids_join= 0; DROP TABLE t1; DROP TABLE t2; --source ../inc/group_replication_end.inc