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_local_applier_error.test |
################################################################################ # Check that local pipeline errors are properly detected and handled. # This test checks that local transactions waiting for certification will # rollback when the applier encounters an error. # # Test: # 0) The test requires two servers: M1 and M2. # 1) Create a group with 2 members and bring them ONLINE. On M1 create a table. # 2) Create a DEBUG point in M1 to force the applier to error out before the # next certification. # 3) Do an insert on M1. As the applier will fail and not certify the # transaction, the query should rollback. # 4) The query should not be on M1. # - Assert check that transaction rolled back locally on M1. # - Assert check M1 is in read mode i.e. super_read_only=1. # 5) Remove DEBUG point and stop GR on M1. Start GR on M1. # - Check that after restarting the service, the value is now on the table. # - Check that GTID_EXECUTED on M1 contains all transactions. # - Check that GTID_EXECUTED on M2 contains all transactions. # 6) Cleanup. ################################################################################ --source include/have_debug.inc --source ../inc/have_group_replication_plugin.inc --source ../inc/group_replication.inc --echo # --echo # 2 member group --echo # Force a pipeline error on certification handler. --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET SESSION sql_log_bin= 0; call mtr.add_suppression("Failed to fetch Transaction_context_log_event containing required transaction info for certification"); call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); call mtr.add_suppression("Error at event handling! Got error: 1"); call mtr.add_suppression("The member is leaving a group without being on one"); call mtr.add_suppression("Due to a plugin error, some transactions can't be certified and will now rollback."); call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); call mtr.add_suppression("Error while waiting for conflict detection procedure to finish on session .*"); call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed"); call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); SET SESSION sql_log_bin= 1; CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET @@GLOBAL.DEBUG= '+d,certification_handler_force_error_on_pipeline'; --echo # --echo # Execute a transaction on member 1 causing the applier to error out --echo # The member should leave the group --echo # --error ER_TRANSACTION_ROLLBACK_DURING_COMMIT, ER_RUN_HOOK_ERROR INSERT INTO t1 VALUES (1); --echo # --echo # Wait until member 1 Group Replication applier errors out. --echo # --let $wait_condition= SELECT service_state="OFF" FROM performance_schema.replication_applier_status WHERE channel_name="group_replication_applier" --source include/wait_condition.inc --let $group_replication_member_state= ERROR --source ../inc/gr_wait_for_member_state.inc --echo # --echo # Assert that the transaction was roll backed locally --echo # --let $assert_text= 'There is no value 1 in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 0 --source include/assert.inc --echo # --echo # Assert that the read mode is active --echo # --let $assert_text= The super_read_only mode should be active. --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1; --source include/assert.inc --echo # --echo # Stop the member and join it again. --echo # SET @@GLOBAL.DEBUG= '-d,certification_handler_force_error_on_pipeline'; --source include/stop_group_replication.inc --source include/start_group_replication.inc --echo # --echo # Check that table 1 now has a value --echo # --let $assert_text= 'There is now a value 1 in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 --source include/assert.inc --echo # --echo # Check that GTID_EXECUTED on server 1 contains all transactions. --echo # --let $assert_text= GTID_EXECUTED must contain all committed GTIDs --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-5" --source include/assert.inc --echo # --echo # Check that GTID_EXECUTED on server 2 contains all transactions. --echo # --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $assert_text= GTID_EXECUTED must contain all committed GTIDs --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-5" --source include/assert.inc --echo # --echo # Test cleanup. --echo # DROP TABLE t1; --source ../inc/group_replication_end.inc