#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';
+$binlog_exists= 0;
+while ($timeout > 0 && $binlog_exists == 0)
+{
+ if (-e $binlog)
+ {
+ $binlog_exists= 1;
+ }
+ 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
Attachment: [text/bzr-bundle] bzr/serge.kozlov@oracle.com-20110427210554-dvn3gov77d5kjkv7.bundle