Sven Sandberg wrote:
> #At file:///home/sven/bzr/b38127-mysqlbinlog_base64/5.1-rpl/
>
> 2630 Sven Sandberg 2008-07-16
> BUG#38127: main.mysqlbinlog_base64 fails sporadically on pushbuild
> Problem: mysqlbinlog_base64 fails because the binlog contains
> traces from previous test cases.
> Fix: Make have_log_bin reset the master's binlog.
> modified:
> mysql-test/include/have_log_bin.inc
> mysql-test/t/mysqlbinlog_base64.test
>
> per-file messages:
> mysql-test/include/have_log_bin.inc
> Made have_log_bin reset the master logs, so that no traces of
> earlier test cases are left.
> mysql-test/t/mysqlbinlog_base64.test
> Removed debug info from previous push to this test.
> === modified file 'mysql-test/include/have_log_bin.inc'
> --- a/mysql-test/include/have_log_bin.inc 2007-05-14 12:38:50 +0000
> +++ b/mysql-test/include/have_log_bin.inc 2008-07-16 09:50:11 +0000
> @@ -1,4 +1,14 @@
> +# ==== Purpose ====
> +#
> +# Ensure that the server is running with binlogging on and reset the
> +# binlog.
> +#
> +# ==== Usage ====
> +#
> +# source include/have_log_bin.inc;
> +
> -- require r/have_log_bin.require
> disable_query_log;
> show variables like "log_bin";
> +RESET MASTER;
This will cause the slave stall until slave connection timeout and then
reconnect.
for example:
rpl_skip_error.test
rpl_drop_temp.test
And in fact you can test this with a simple test case like this:
------------------------------------------------
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
create table t1 (a int);
sync_slave_with_master;
------------------------------------------------
This test will take more than 120s to finish, if we switch the two
include lines, it will finish in less than 1s. The reason is because
have_binlog_format_statement.inc included have_log_bin.inc by itself,
after your patch, it resets master and cause the slave wait for update
from already deleted binlog file until timeout and reconnect.
The reason why slave will wait until timeout is because when master runs
RESET MASTER, it will delete all binlog files and recreat a new one
without notify DUMP threads, so all the DUMP threads will still keep the
binlog file they are using open and waiting for updates to this binlog
file.
In the above example, after the RESET MASTER in
have_binlog_format_statement.inc, the DUMP thread connected to slave
will keep the old master-bin.000001 open and keep waiting for update
from this file, while the master has already switched to a newly created
master-bin.000001. So when DUMP thread get update signal it will not
read any new content and so no new event will be send to slave until
slave timeout and reconnect.
This also caused test case rpl_loaddata_map.test failure, the reason can
be illustrated by the simplified example below:
---------------------------------------------
1. source include/master-slave.inc;
2. reset master;
3. create table t1 (a int);
4. flush logs;
5. create table t2 (a int);
6. sync_slave_with_master;
7. show tables;
----------------------------------------------
after 1. DUMP thread will be waiting for update from master-bin.000001
after 2. the old master-bin.000001 will be removed and a new one
created, but the DUMP thread will still keep using the old one
after 3. this statement is written into the new master-bin.000001, so
although the DUMP thread was notified , but it will not read any
content. And it will waiting again.
after 4. master-bin.000001 will be flushed and closed, rotate to
master-bin.000002 and signal all DUMP threads, so the DUMP thread will
notic that master-bin.000001 is no longer the active binlog and then
switch to the next one master-bin.000002, and continue replicating. So
as we can see, all the content master-bin.000001 will be ignored, so
table t1 will not exist on slave.
after 5. this statement will be replicated correctly.
So I reverted the changes to have_log_bin.inc and added reset master to
mysqlbinlog_base64.test directly instead.
> enable_query_log;
>
> === modified file 'mysql-test/t/mysqlbinlog_base64.test'
> --- a/mysql-test/t/mysqlbinlog_base64.test 2008-07-15 16:05:39 +0000
> +++ b/mysql-test/t/mysqlbinlog_base64.test 2008-07-16 09:50:11 +0000
> @@ -32,21 +32,6 @@ drop table t2;
> select * from t1;
> select * from t2;
>
> -# DEBUG CODE ADDED BY SVEN. BUG#38127
> -let $count_t1= `SELECT COUNT(*) FROM t1`;
> -let $count_t2= `SELECT COUNT(*) FROM t2`;
> -if (`SELECT $count_t1 != 3 OR $count_t2 != 70`)
> -{
> - --echo Test case bug! See BUG#38127. Printing debug info.
> - --cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
> - SHOW MASTER STATUS;
> - SHOW BINLOG EVENTS;
> - --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001
> - SHOW TABLES;
> - exit;
> -}
> -# END DEBUG CODE
> -
> #
> # Verify that events larger than the default IO_CACHE buffer
> # are handled correctly (BUG#25628).
>