################################################################################ # Test that evaluates basics about transaction control when joining, # # 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 that the M2 can now join the group after the extra data # is removed. # 4) Verify all is fine. Check data in table on M2. # 5) Clean up. ################################################################################ --source include/big_test.inc --let $group_replication_group_name= c645abc0-ebb9-11e5-a837-0800200c9a66 --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source include/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(".*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 include/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]* \[ERROR\] \[[^\]]*\] */DATE_TIME [ERROR] / --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]* \[ERROR\] \[[^\]]*\] */DATE_TIME [ERROR] / --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 that server 2 can now join after extra data is removed. --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 include/gr_wait_for_number_of_members.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc DROP TABLE t2; RESET MASTER; --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); --source include/rpl_sync.inc --let $rpl_connection_name= server2 --source include/rpl_connection.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 # DROP TABLE t1; --source include/group_replication_end.inc