polardbxengine/mysql-test/suite/rpl/t/rpl_mts_logical_clock_times...

164 lines
3.9 KiB
Plaintext

#
# The test verifies execution specially timestamped transactions and
# erroring out due to inconsistent timestamps found.
#
--source include/have_debug.inc
--source include/master-slave.inc
# format - non-specific test is enough to executed in MIXED mode only.
--source include/have_binlog_format_mixed.inc
--connection slave
call mtr.add_suppression("Transaction is tagged with inconsistent logical timestamps");
call mtr.add_suppression("Cannot execute the current event group in the parallel mode.");
#call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
--source include/stop_slave.inc
SET @save_slave_parallel_type = @@GLOBAL.slave_parallel_type;
SET @save_slave_parallel_workers = @@GLOBAL.slave_parallel_workers;
SET @save_slave_transaction_retries = @@GLOBAL.slave_transaction_retries;
SET GLOBAL slave_parallel_type = LOGICAL_CLOCK;
SET GLOBAL slave_parallel_workers = 3;
SET GLOBAL slave_transaction_retries = 0;
#
# Part I. "Rotated" transactions apply correctly.
# At times Master generalates last_committed as magic SEQ_UNINIT which
# designates the transaction's commit parent is unknown so
# it has to be applied in exclusive environment, aka
# fallback to sequential mode.
#
# Create a chain of binlogs containing two consequent SEQ_UNINIT last_committed
# transactions in one them.
connect (master2,localhost,root,,);
--connection master
--let $MYSQLD_DATADIR= `select @@datadir`
--let $events_file=$MYSQLTEST_VARDIR/tmp/events.sql
RESET MASTER; # make sure we start from 0000001 binlog
CREATE TABLE t1 (a int) ENGINE= innodb;
INSERT INTO t1 SET a=1;
--connection master1
BEGIN;
INSERT INTO t1 SET a=2;
--connection master2
BEGIN;
INSERT INTO t1 SET a=3;
--connection master
FLUSH LOGS;
--connection master1
COMMIT;
--connection master2
COMMIT;
# two timestamp pair of (0,[12]) must be found.
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000002 > $events_file
--let $grep_file= $events_file
--let $grep_pattern= last_committed=0\tsequence_number=[12]
--let $grep_output= print_count
--source include/grep_pattern.inc
# Create a chain of binlogs containing two consequent SEQ_UNINIT last_committed
# transactions separated by a Rotate event.
--connection master
INSERT INTO t1 SET a=1;
--connection master1
BEGIN;
INSERT INTO t1 SET a=2;
--connection master2
BEGIN;
INSERT INTO t1 SET a=3;
--connection master
FLUSH LOGS;
--connection master1
COMMIT;
--connection master
FLUSH LOGS;
--connection master2
COMMIT;
--connection master
--send INSERT INTO t1 SET a=1
--connection master1
--send INSERT INTO t1 SET a=2
--connection master2
--send INSERT INTO t1 SET a=3
--connection master
--reap
--connection master1
--reap
--connection master2
--reap
--connection slave
--source include/start_slave.inc
# Proof of correctess stable execution
--connection master
--sync_slave_with_master
--let $diff_tables=master:t1,slave:t1
--source include/diff_tables.inc
#
# Part II. Let's feign inconsistent timestamping
# to see how Slave expectedly stops.
#
--connection master
SET @@session.debug ='+d,feign_commit_parent';
INSERT INTO t1 SET a=0;
SET @@session.debug ='-d,feign_commit_parent';
--connection slave
--let $slave_sql_errno= convert_error(ER_MTS_CANT_PARALLEL)
--source include/wait_for_slave_sql_to_stop.inc
--source include/stop_slave_io.inc
# "Manual" recovery to restart anew 'cos of the schrambled event
--connection master
RESET MASTER;
--connection slave
RESET SLAVE;
RESET MASTER;
--source include/start_slave.inc
#
# Cleanup
#
--connection master
DROP TABLE t1;
--remove_file $events_file
--sync_slave_with_master
#--connection slave
--source include/stop_slave.inc
SET @@GLOBAL.slave_parallel_type= @save_slave_parallel_type;
SET @@GLOBAL.slave_parallel_workers= @save_slave_parallel_workers;
SET @@GLOBAL.slave_transaction_retries= @save_slave_transaction_retries;
--source include/start_slave.inc
--source include/rpl_end.inc