Hi Serge,
The patch looks OK. I have one request though... Please,
find it inline. Also, consider merging this cset to take
care of the timeouts in FreeBSD:
- http://lists.mysql.com/commits/136698
Regards,
Luís
On 04/27/2011 10:06 PM, Serge Kozlov wrote:
> #At file:///home/ksm/oracle/repo/bugs_suite/mysql-trunk/ based on
> revid:sven.sandberg@stripped
>
> 3331 Serge Kozlov 2011-04-28
> BUG#11761610. Add waiting of binlog files from mysqlbinlog that running in
> background.
>
> modified:
> mysql-test/t/mysqlbinlog_raw_mode.test
> === modified file 'mysql-test/t/mysqlbinlog_raw_mode.test'
> --- a/mysql-test/t/mysqlbinlog_raw_mode.test 2011-03-07 15:17:39 +0000
> +++ b/mysql-test/t/mysqlbinlog_raw_mode.test 2011-04-27 21:05:54 +0000
> @@ -10,14 +10,35 @@ CREATE TABLE raw_mode_exit (exit_code IN
> # Now jump some loops to have mysqlbinlog executed in the background
> --write_file $MYSQL_TMP_DIR/mbl.sh
> #!/bin/sh
> -(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root
> --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/
> master-bin.000001 ; [ $? -le 1 ]`&& $MYSQL -e "use test; INSERT INTO
> raw_mode_exit VALUES (1);")< /dev/null> /dev/null 2>&1&
> +(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root
> --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQL_TMP_DIR/ master-bin.000001 ; [
> $? -le 1 ]`&& $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);")<
> /dev/null> /dev/null 2>&1&
> EOF
> --chmod 0755 $MYSQL_TMP_DIR/mbl.sh
> --exec $MYSQL_TMP_DIR/mbl.sh
> let $wait_condition= SELECT id from information_schema.processlist where
> processlist.command like '%Binlog%' and state like '%Master has sent%';
> --source include/wait_condition.inc
> ---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001
> $MYSQLD_DATADIR/master-bin.000001
> ---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000002
> $MYSQLD_DATADIR/master-bin.000002
> +
> +# Wait until creating binlog files by mysqlbinlog
> +--perl
> +$timeout= 30;
> +$binlog= $ENV{'MYSQL_TMP_DIR'} . '/master-bin.000002';
I think you should wait for master-bin.000003 . That way one is
sure that master-bin.000002 was created *and* was fully
retrieved. Otherwise, we may find that the file exists, but
it is still being written into. This would probably cause the
comparison to fail (we would be comparing half written files
against a full one - yes, it's unlikely, but better to prevent
yet this other race).
> +$binlog_exists= 0;
> +while ($timeout> 0&& $binlog_exists == 0)
> +{
> + if (-e $binlog)
> + {
> + $binlog_exists= 1;I think you should wait for master-bin.000003 . That way one is
sure that master-bin.000002 was created *and* was fully
retrieved. Otherwise, we may find that the file exists, but
it is still being written into. This would cause the comparison
to fail.
> + }
> + sleep 1;
> + $timeout--;
> +}
> +if ($timeout == 0&& $binlog_exists == 0)
> +{
> + print "Timeout reached but binlog file $binlog was not created";
> +}
> +EOF
> +
> +--diff_files $MYSQL_TMP_DIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
> +--diff_files $MYSQL_TMP_DIR/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
>
> SELECT ((@id := id) - id) from information_schema.processlist where
> processlist.command like '%Binlog%' and state like '%Master has sent%';
> # Test killing from mysql server
> @@ -26,9 +47,9 @@ kill @id;
> --source include/wait_condition.inc
>
> DROP TABLE raw_mode_exit;
> ---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
> ---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
> ---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
> +--remove_file $MYSQL_TMP_DIR/master-bin.000001
> +--remove_file $MYSQL_TMP_DIR/master-bin.000002
> +--remove_file $MYSQL_TMP_DIR/master-bin.000003
> --remove_file $MYSQL_TMP_DIR/mbl.sh
>
> --echo End of tests
>
>
>
>
>