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_multi_source_mts_slave_retry.test

#
# Test that in MSR+MTS setup, a worker retries a transaction
# for a channel
# Idea of the test:
# 1. setup a named replication channel to a master
# 2. Lock the tables on a slave
# 3. Replicate the data to the same table
# 4. See that the worker retries transaction and transaction retry count
#    is increased.
# 5. Do Roll back on the slave.
# 6. Check that data on the master and slave is same as retry of the
#    transaction this time will be succesful
#

--source include/not_group_replication_plugin.inc
--source include/only_mts_slave_parallel_workers.inc

--echo # Create channel_1 to server_1 from server_2(slave)
--let $rpl_topology= 1->2
--let $rpl_multi_source =1
--source include/rpl_init.inc

--echo #
--echo # Insert data on the master
--echo #
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
CREATE TABLE t1( a int unique);

--echo # sync data to the slave
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $rpl_channel_name= channel_1
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc

--echo # stop slave
--source include/rpl_stop_slaves.inc

# Backup the original value of the variables
SET @saved_innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout;
SET @saved_slave_transaction_retries = @@GLOBAL.slave_transaction_retries;

--echo #
--echo # Set the variables needed for this test
--echo #
SET GLOBAL slave_transaction_retries=10;
SET GLOBAL innodb_lock_wait_timeout=2;

--echo #start slave
--source include/rpl_start_slaves.inc

--echo #
--echo # Lock the rows of the table t1
--echo #
BEGIN;
INSERT INTO t1 VALUES(1);


--echo #
--echo # Insert the rows on the same table on master
--echo #
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES(1);

--echo #
--echo # On slave, check that this transaction from the master has been retried.
--echo #
--let  $rpl_connection_name= server_2
--source include/rpl_connection.inc

--let $wait_timeout=60
--let $wait_condition= SELECT  COUNT_TRANSACTIONS_RETRIES>=2 FROM performance_schema.replication_applier_status WHERE channel_name="channel_1";
--source include/wait_condition.inc

--echo # Release the lock.
ROLLBACK;

--echo # Now sync with master on channel_1
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $rpl_channel_name= channel_1
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc

--echo # check that data shows the value 1
SELECT * FROM t1;

--echo #cleanup
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
DROP TABLE t1;
--let $rpl_channel_name= channel_1
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc

# restore the old values

SET GLOBAL innodb_lock_wait_timeout = @saved_innodb_lock_wait_timeout;
SET GLOBAL slave_transaction_retries = @saved_slave_transaction_retries;

--let $rpl_skip_sync=1
--source include/rpl_end.inc

Man Man