diff options
author | unknown <guilhem@mysql.com> | 2003-04-24 15:29:25 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-04-24 15:29:25 +0200 |
commit | 9f4f19d9f77433e02e9985d9c2f3224d062173b3 (patch) | |
tree | 0264c0e9bae7ff461d619885e3e94778f1749a23 /mysql-test/t/rpl_relayrotate.test | |
parent | 4ac98ec5215dedff9e24b91d305e9eec5ee3b96f (diff) | |
download | mariadb-git-9f4f19d9f77433e02e9985d9c2f3224d062173b3.tar.gz |
Replication: new code to not modify in-memory log positions until the COMMIT
is executed, even if the transaction spans on >=2 relay logs (bug #53).
New variable relay_log_purge =0|1
New test to verify bug #53
sql/log.cc:
Now we purge a relay log only when we are sure we won't need it,
i.e. we have executed the final query (if autocommit=1) or the COMMIT.
sql/log_event.cc:
Better tracking of the relay log's name and position
lastly executed, even if we are in a transaction which spans on
2 or more relay logs.
sql/mysql_priv.h:
new option relay_log_purge (the user can now decide himself
if he wants his relay logs to be automatically purged or not,
we don't make unsafe guesses like before)
sql/mysqld.cc:
new option --innodb (replaces --skip-innodb).
Useful for the test suite : we have skip-innodb in mysql-test-run,
but we can ('-opt.info' file) choose to start the server with
InnoDB for this test only.
New option --bdb
sql/repl_failsafe.cc:
Better tracking of the relay log's name and position
lastly executed, even if we are in a transaction which spans on
2 or more relay logs.
sql/set_var.cc:
new variable relay_log_purge
sql/slave.cc:
Better tracking of the relay log's name and position
lastly executed, even if we are in a transaction which spans on
2 or more relay logs.
Now we purge a relay log only when we are sure we won't need it,
i.e. we have executed the final query (if autocommit=1) or the COMMIT
sql/slave.h:
Better tracking of the relay log's name and position
lastly executed, even if we are in a transaction which spans on
2 or more relay logs.
sql/sql_class.h:
prototypes change
sql/sql_parse.cc:
removed thd argument (was not used in the function's body)
sql/sql_repl.cc:
Better tracking of the relay log's name and position
lastly executed, even if we are in a transaction which spans on
2 or more relay logs.
Turn relay_log_purge silently off when someone does CHANGE
MASTER TO RELAY_LOG_*
Diffstat (limited to 'mysql-test/t/rpl_relayrotate.test')
-rw-r--r-- | mysql-test/t/rpl_relayrotate.test | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test new file mode 100644 index 00000000000..4c330b8c9a2 --- /dev/null +++ b/mysql-test/t/rpl_relayrotate.test @@ -0,0 +1,61 @@ +# 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) + +# If the master or slave does not support InnoDB, this test will pass + +source include/master-slave.inc; +connection slave; +stop slave; +connection master; +create table t1 (a int) type=innodb; +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. +system 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, MASTER_POS_WAIT() will do it for sure +# (the only statement with position>=3000 is COMMIT). +# Older versions of MySQL would hang forever in MASTER_POS_WAIT +# because COMMIT was said to be position 0 in the master's log (bug). +# Detect this with timeout. +select master_pos_wait('master-bin.001',3000,120)=-1; +select * from t1 where a=8000; +# Note that the simple fact to have less than around 30 slave's binlogs +# (the slave is started with --log-slave-updates) is already +# a proof that the transaction was not properly resumed. |