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

# This test check if the option slave-preserve-commit order
# preserves the commit order with slave binlog enabled.
--source include/not_group_replication_plugin.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc

# METHOD: We will do some inserts of continious integers into a t1.a
# and enable a forced parallelization. These transactions are applied in
# parallel on the slave. We re-apply the transactions in slave binlog another
# table which contains an additional column (id) of auto increment integer.
# If trasactions are written in order into the slave binlog, then after
# reapplying there will be no rows where t.id != t.a
#
# This script is used with logical clock based MTS.
#

--source include/rpl_connection_master.inc
CREATE TABLE t1 (a INT) ENGINE = InnoDB;

--source include/sync_slave_sql_with_master.inc
--source include/rpl_connection_slave.inc
# Make all following INSERTs into the 2nd binlog.
FLUSH BINARY LOGS;
if (`SELECT @@GLOBAL.gtid_mode = "ON"`)
{
  --disable_query_log
  SET @gtid_set_before_insert = @@GLOBAL.gtid_executed;
  --enable_query_log
}

--echo #
--echo # Verify the transactions are ordered correctly on slave
--echo #
--source include/rpl_connection_master.inc
# Make the following INSERTs have same commit parent. So they can be applied
# parallel on slave.
SET @save_debug = @@GLOBAL.debug;
SET GLOBAL debug = "d,set_commit_parent_100";

# In each iteration, the master generates some transactions which can be applied
# parallel. Slave is running in MTS mode and has 6 workers. To guarantee all
# transactions are put into the queue togeter, LOCK TABLES is used to block
# workers. After all transactions are in the queue, then UNLOCK TABLES is
# called and all workers can resume.

--let $iteration = 1
# value is from 1 to 21
--let $value = 1

while ($iteration <= 6)
{
  --source include/rpl_connection_slave.inc
  LOCK TABLE t1 WRITE;

  --source include/rpl_connection_master.inc
  --let $row_count= 1
  while ($row_count <= $iteration)
  {
    --eval INSERT INTO t1(a) VALUES ($value)
    --inc $value
    --inc $row_count
  }
  --source include/save_master_pos.inc

  --source include/rpl_connection_slave.inc
  # Wait until all workers are blocked by LOCK TABLE t1 WRITE. It implies all
  # transactions are registered into the order commit queue.
  let $wait_condition= SELECT count(*) = $iteration FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'Waiting for table metadata lock';
  --source include/wait_condition.inc

  UNLOCK TABLES;
  --source include/sync_slave_sql.inc
  SET DEBUG_SYNC = 'RESET';
  --inc $iteration
}

#
# Verify above INSERTs are in the same order as master
#
--source include/rpl_connection_slave.inc
--let $SLAVE_MYSQLD_DATADIR= `SELECT @@DATADIR`
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--copy_file $SLAVE_MYSQLD_DATADIR/$binlog_file $MYSQL_TMP_DIR/$binlog_file

# Slave's binlog will be replied one by one later through mysql. The table is
# recreated with an extra auto increment field. The new field 'id' will be
# filled by server automatically when replying slave's binlog. So It exactly
# records the binlogging order of the transactions.

DROP TABLE t1;
CREATE TABLE t1 (a INT, id INT AUTO_INCREMENT KEY) ENGINE = InnoDB;

# To clear gtid set when gtid mode is ON.
if (`SELECT @@GLOBAL.gtid_mode = "ON"`)
{
  --disable_query_log
  RESET MASTER;
  SET @@global.gtid_purged= @gtid_set_before_insert;
  --enable_query_log
}

# Replay slave's binlog
--exec $MYSQL_BINLOG $MYSQL_TMP_DIR/$binlog_file |$MYSQL_SLAVE

# The transactions should be binlogged in the same order as they are binlogged
# on master. Because the transactions inserts consecutive numbers starting from
# 1 and id starts from 1 and step 1 for each transaction. The table's data should
# look like:
# id    a
# 1     1
# 2     2
# ...  ...
# n     n
# It means the values of field 'id' are always same to the values of field 'a'
SELECT * FROM t1 WHERE id <> a;

--let $assert_text= 'There are no mismatched rows'
--let $assert_cond= [SELECT  COUNT(*) AS count FROM t1 WHERE t1.id <> t1.a, count, 1] = 0
--source include/assert.inc

--let $assert_text= 'There are no row which is null'
--let $assert_cond= [SELECT  COUNT(*) AS count FROM t1 WHERE t1.a is NULL, count, 1] <= 0
--source include/assert.inc

--let $assert_text= 'There are 21 rows'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 21
--source include/assert.inc

--remove_file $MYSQL_TMP_DIR/$binlog_file

--source include/rpl_connection_master.inc
SET GLOBAL debug = @save_debug;

DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc

--echo #
--echo # Verify that it will generate a warning if slave-preserve-commit is
--echo # used with DB PARTITIONED MTS together
--echo #
--source include/stop_slave_sql.inc
SET GLOBAL slave_parallel_type = 'DATABASE';
--error ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER
START SLAVE SQL_THREAD;

SET GLOBAL slave_parallel_type = 'LOGICAL_CLOCK';
--let rpl_only_running_threads= 1;
--source include/rpl_end.inc


Man Man