mariadb/mysql-test/t/rpl_relayrotate.test
unknown f1a5003548 Fixes for Bug#12429: Replication tests fail: "Slave_IO_Running" (?) differs related to
MySQL 4.1
  and Bug#16920 rpl_deadlock_innodb fails in show slave status (reported for MySQL 5.1)
  - backport of several fixes done in MySQL 5.0 to 4.1
  - fix for new discovered instability (see comment on Bug#12429 + Bug#16920)
  - reenabling of testcases


mysql-test/r/rpl_deadlock.result:
  Updated results
mysql-test/r/rpl_relayrotate.result:
  Updated results
mysql-test/t/disabled.def:
  Reenabling of tests
mysql-test/t/rpl_deadlock.test:
  - replace sleep with real_sleep (backport fix for Bug#15624 MySQL 5.0)
  - egalized value for Slave_IO_Running 
  - line 105 (backport fix for Bug#12429 MySQL 5.0)
  - line 85 (see comment in Bug#12429 
             + Bug#16920 rpl_deadlock_innodb fails in show slave status)
  - improve readability of show slave status output (--vertical_results)
mysql-test/t/rpl_relayrotate.test:
  - Replace select ... with select max(a)
  - add sync_with_master (backport fix done by Kristian in MySQL 5.0 because of timing
    problems similar to Bug#15624)
mysql-test/t/rpl_until.test:
  Add wait_for_slave_to_stop like in the current MySQL 5.0 version of this test.
  I assume this makes the test results more predictable.
2006-04-13 20:42:48 +02:00

75 lines
2.4 KiB
Text

# When the relay log gets rotated while the I/O thread
# is reading a transaction, the transaction spans on two or more
# relay logs. If STOP SLAVE occurs while the SQL thread is
# executing a part of the transaction in the non-first relay logs,
# we test if START SLAVE will resume in the beginning of the
# transaction (i.e., step back to the first relay log)
# The slave is started with max_binlog_size=16384 bytes,
# to force many rotations (approximately 30 rotations)
source include/have_innodb.inc;
source include/master-slave.inc;
connection slave;
stop slave;
connection master;
--disable_warnings
create table t1 (a int) engine=innodb;
--enable_warnings
let $1=8000;
disable_query_log;
begin;
while ($1)
{
# eval means expand $ expressions
eval insert into t1 values( $1 );
dec $1;
}
commit;
# This will generate a 500kB master's binlog,
# which corresponds to 30 slave's relay logs.
enable_query_log;
save_master_pos;
connection slave;
reset slave;
start slave;
# We wait 1 sec for the SQL thread to be somewhere in
# the middle of the transaction, hopefully not in
# the first relay log, and hopefully before the COMMIT.
# Usually it stops when the SQL thread is around the 15th relay log.
# We cannot use MASTER_POS_WAIT() as master's position
# increases only when the slave executes the COMMIT.
# Note that except when using Valgrind, 1 second is enough for the I/O slave
# thread to fetch the whole master's binlog.
sleep 1;
stop slave;
# We suppose the SQL thread stopped before COMMIT.
# If so the transaction was rolled back
# and the table is now empty.
# Now restart
start slave;
# And see if the table contains '8000'
# which proves that the transaction restarted at
# the right place.
# We must wait for the transaction to commit before
# reading:
sync_with_master;
select max(a) from t1;
connection master;
# The following DROP is a very important cleaning task:
# imagine the next test is run with --skip-innodb: it will do
# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
# some data in the InnoDB datafile (because at that time mysqld
# does not know about InnoDB : --skip-innodb). So if later in the
# test suite a test wants to create an InnoDB table called t1, it
# will fail with
# InnoDB: Error: table t1 already exists in InnoDB internal
# InnoDB: data dictionary. Have you deleted the .frm file etc
drop table t1;
# wait until this drop is executed on slave
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests