1 # When the relay log gets rotated while the I/O thread
2 # is reading a transaction, the transaction spans on two or more
3 # relay logs. If STOP SLAVE occurs while the SQL thread is
4 # executing a part of the transaction in the non-first relay logs,
5 # we test if START SLAVE will resume in the beginning of the
6 # transaction (i.e., step back to the first relay log)
8 # The slave is started with max_binlog_size=16384 bytes,
9 # to force many rotations (approximately 30 rotations)
11 # We have to sync with master, to ensure slave had time to start properly
12 # before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
14 sync_slave_with_master;
19 eval create table t1 (a int) engine=$engine_type;
26 # eval means expand $ expressions
27 eval insert into t1 values( $1 );
31 # This will generate a 500kB master's binlog,
32 # which corresponds to 30 slave's relay logs.
38 # We wait 1 sec for the SQL thread to be somewhere in
39 # the middle of the transaction, hopefully not in
40 # the first relay log, and hopefully before the COMMIT.
41 # Usually it stops when the SQL thread is around the 15th relay log.
42 # We cannot use MASTER_POS_WAIT() as master's position
43 # increases only when the slave executes the COMMIT.
44 # Note that except when using Valgrind, 1 second is enough for the I/O slave
45 # thread to fetch the whole master's binlog.
48 # We suppose the SQL thread stopped before COMMIT.
49 # If so the transaction was rolled back
50 # and the table is now empty.
53 # And see if the table contains '8000'
54 # which proves that the transaction restarted at
56 # We must wait for the transaction to commit before
57 # reading, with a sync_with_master.
59 select max(a) from t1;
62 # The following DROP is a very important cleaning task:
63 # imagine the next test is run with --skip-innodb: it will do
64 # DROP TABLE IF EXISTS t1; but this will delete the frm and leave
65 # some data in the InnoDB datafile (because at that time mysqld
66 # does not know about InnoDB : --skip-innodb). So if later in the
67 # test suite a test wants to create an InnoDB table called t1, it
69 # InnoDB: Error: table t1 already exists in InnoDB internal
70 # InnoDB: data dictionary. Have you deleted the .frm file etc
72 # wait until this drop is executed on slave