config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/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
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_bug26395.test

# ==== Purpose ====
#
# Tests that an autocommitted XA transaction where the master crashes
# just before writing the XID log event is executed correctly.  The
# master rolls back, so the slave should not execute statement.
#
# This test was previously part of rpl_ndb_transaction.test
#
#
# ==== Method ====
#
# We want master to be alive so that it can replicate the statement to
# the slave. So in the test case, we must not crash the
# master. Instead, we fake the crash by just not writing the XID event
# to the binlog. This is done by the @@debug='d,do_not_write_xid'
# flag. This, in turn, requires us to do 'source
# include/have_debug.inc'
#
# So, unlike if the master had crashed, the master *will* execute the
# statement. But the slave should not execute it. Hence, after the
# test is executed, the expected result on master is a table with one
# row, and on slave a table with no rows.
#
# To simulate the slave correctly, we wait until everything up to but
# not including the XID is replicated. This has to be done with
# include/sync_slave_io_with_master.inc, not sync_slave_with_master,
# since the latter waits until the slave *SQL* thread has caught up
# with the master's position, which it will never do.
#
#
# ==== Related bugs ====
#
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails

--source include/not_group_replication_plugin.inc
source include/have_innodb.inc;
# have_debug is needed since we use the @@debug variable on master
source include/have_debug.inc;
source include/master-slave.inc;

# test adapts simulation of incomplete transaction that MTS does not tolerate
# when is stopped. So it reacts with an error whereas the single-threaded is fine.
-- source include/not_mts_slave_parallel_workers.inc


--echo ==== Initialize ====

--echo [on master]
--connection master

CREATE TABLE tinnodb (a INT) ENGINE = INNODB;
SHOW CREATE TABLE tinnodb;

# do_not_write_xid stops the master from writing an XID event.
set @old_debug= @@debug;
set @@debug= 'd,do_not_write_xid';


--echo ==== Test ====

# Save the position up to which the slave SQL thread should execute.
save_master_pos;

# Execute query and check that the row made it to the table.
INSERT INTO tinnodb VALUES (1);
SELECT * FROM tinnodb ORDER BY a;

# Sync slave's IO thread.
--echo [on slave]
# After the implementation of the transaction boundary parser,
# this sync cannot use GTIDs or else sync will timeout because only
# GTIDs of fully replicated transactions are in the
# Retrieved_Gtid_Set of the slave and, as the last event of the
# transaction never arrives, syncing with GTIDs won't work.
--let ignore_gtids_on_sync= 1
source include/sync_slave_io_with_master.inc;

# Sync slave's SQL thread.
sync_with_master 0;

--echo ==== Verify results on slave ====

source include/stop_slave.inc;

--let $status_items=Slave_IO_State,Last_SQL_Error,Last_IO_Error
--source include/show_slave_status.inc

--let $assert_text= Assert that the slave table has no rows
--let $assert_cond= `SELECT COUNT(*) = 0 FROM tinnodb`
--source include/assert.inc

--echo ==== Clean up ====

# Easiest to clean up master and slave separately, without
# replication, since master and slave are out of sync.

--echo [on master]
connection master;
DROP TABLE tinnodb;
set @@debug= @old_debug;

--echo [on slave]
connection slave;
DROP TABLE tinnodb;

# Warning: do not add more tests here. The binlog is in a bad state.
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

Man Man