GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/mysql-test/extra/rpl_tests/
Upload File :
Current File : //usr/share/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test

################################################################################
# This test case aims to check if the recovery routine develop as part of the
# WL#5599 works correctly. To do so, we generate a set of changes, i.e. a set
# of transactions, as follows:
#
#   DB_1 ... DB_1 DB_2 ... DB_2 ... DB_w ... DB_w
#   |         |   |         |       |         |
#   ---- a ----   ---- a ----       ---- a ----
#   |         |   |         |       |         |
#   ---- p ----   ---- p ----       ---- p ----
#   |         |
#   ---- c ----   
#
#  DB_w is a transaction on database "w" that is assigned to worker "w" and
#  may be generated "a" times. Within each "a" group, "p" transactions are
#  processed by their assigned workers and within the first group, only "c"
#  transactions are processed by the checkpoint routine.
#
#  The following properties hold:
#
#  . 0 <= p <= a
#  . 0 <= c <= p
#
#  So after assigning "a" transactions to each worker, waiting that "p"
#  transactions are processed by each worker and "c" are processed by the
#  checkpoint routine, the slave is rebooted thus executing the recovery
#  routine with a mix of processed and unprocessed transactions.
#
#  Along with this, the relay log is rotated and during startup the relay
#  log files are delete based on the option relay-log-recovery.
#
#  At the end, master and slave cannot diverge.
################################################################################
#  Clean all configuration changes after running the test.
--source include/force_restart.inc


--echo ########################################################################
--echo #                               SET UP
--echo ########################################################################
if (`select '$crash_safe_small' <> ''`)
{
  --echo 'Small rpl_mts_crash_safe'
  let $max_groups=2;
  let $max_workers=2;
}
if (`select '$crash_safe_small' = ''`)
{
  --echo 'Big rpl_mts_crash_safe'
  let $max_groups=3;
  let $max_workers=3;
}
--let $verbose= 0
--connection master
--let $commands= configure
--let $engine_type="Innodb"
--source extra/rpl_tests/rpl_mts_crash_safe.inc


--echo ########################################################################
--echo #                                TEST 
--echo ########################################################################
let $count_debug_groups=1;
while ($count_debug_groups <= $max_groups)
{
  let $count_workers=1;
  while ($count_workers <= $max_workers)
  {
    let $count_checkpoint=0;
    while ($count_checkpoint <= $count_debug_groups)
    {
      let $count_groups=$count_debug_groups;
      while ($count_groups <= $max_groups)
      {
        --connection slave
        --eval SET @@global.slave_parallel_workers= $count_workers
        --eval SET @@global.slave_checkpoint_period= $count_checkpoint
        let $count_transactions=1;
        while ($count_transactions <= $count_groups)
        {
          let $count_database=1;
          while ($count_database <= $count_workers)
          {
            --connection master
            --let $database_name=test_$count_database
            --echo Generating Number of Workers $count_workers --- Number of Groups per worker $count_groups --- Debugging Groups $count_debug_groups --- Database $database_name
            --let $commands= B T T C
            --source extra/rpl_tests/rpl_mts_crash_safe.inc
            inc $count_database;
          }
          inc $count_transactions;
        }
        --echo ----Executing----
        --let $commands= recovery
        --source extra/rpl_tests/rpl_mts_crash_safe.inc
        inc $count_groups;
      }
      inc $count_checkpoint;
    }
    inc $count_workers;
  }
  inc $count_debug_groups;
}


--echo ########################################################################
--echo #                          CHECK CONSISTENCY
--echo ########################################################################
--connection slave
--source include/start_slave.inc

--connection master
--source include/sync_slave_sql_with_master.inc

--connection master

let $MYSQLD_DATADIR= `SELECT @@datadir`;

--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info --set-gtid-purged=off test > $MYSQLD_DATADIR/test-mts-crash-master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info --set-gtid-purged=off test > $MYSQLD_DATADIR/test-mts-crash-slave.sql
--diff_files $MYSQLD_DATADIR/test-mts-crash-master.sql $MYSQLD_DATADIR/test-mts-crash-slave.sql


--echo ########################################################################
--echo #                             CLEAN UP
--echo ########################################################################
--connection master
# Resetting the slave's info repository type to its default (FILE)
# should be done to any tests that starts the server with non-default (TABLE).
# That prevents the following tests in a suite execution to hit
# Bug #14827923 RPL TEST RPL_PARALLEL_CHANGE_MASTER FAILS WITH WARNING
# Technically resetting of the repo type is implemented through
# one to slave_parallel_workers. Having it zero in the info table
# at the following restart makes the slave server to quietly migrate
# the repository to the requested type.
# Notice that Bug#15858271 of mtr does not allow effectiveness of
# zeroing.
# TODO: run the combination described on Bug#15858271 after it's fixed.

--let $saved_workers= 0
--let $commands= clean
--source extra/rpl_tests/rpl_mts_crash_safe.inc

--connection master
--source include/rpl_end.inc

./BlackJoker Mini Shell 1.0