From 3c5c8787154a30a11a2765da3d98490c5106c239 Mon Sep 17 00:00:00 2001 From: Leonard Zhou Date: Wed, 11 Mar 2009 13:35:58 +0800 Subject: [PATCH] BUG#39858 rpl.rpl_rotate (rpl.rpl_rotate_logs) failed on pushbuild: result mismatch The method to purge binary log files produces different results in some platforms. The reason is that the purge time is calculated based on table modified time and that can't guarantee to purge master-bin.000002 in all platforms.(eg. windows) Use a new way that sets the time to purge binlog file 1 second after the last modified time of master-bin.000002. That can be sure that the file is always deleted in any platform. mysql-test/suite/rpl/r/rpl_rotate_logs.result: Test result mysql-test/suite/rpl/t/rpl_rotate_logs.test: Change 'purge time' 1 sencond after the last modified time of master-bin.000002. --- mysql-test/suite/rpl/r/rpl_rotate_logs.result | 4 +-- mysql-test/suite/rpl/t/rpl_rotate_logs.test | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 6314a9a61fb..013ba87ec0b 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -87,9 +87,7 @@ show binary logs; Log_name File_size master-bin.000002 # master-bin.000003 # -select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) -from information_schema.tables -where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +SELECT @time_for_purge:=DATE_ADD('tmpval', INTERVAL 1 SECOND); purge master logs before (@time_for_purge); show binary logs; Log_name File_size diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index 2bad7b27272..6fc09c93fe6 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -112,14 +112,31 @@ source include/show_master_logs.inc; purge binary logs to 'master-bin.000002'; source include/show_binary_logs.inc; -# Calculate time to use in "purge master logs before" by taking -# last modification time of t2 and adding 1 second -# This is donw in order to handle the case where file system -# time differs from mysqld's time +# Set the purge time 1 second after the last modify time of master-bin.000002. +let $MYSQLD_DATADIR= `select @@datadir`; +--exec stat $MYSQLD_DATADIR/master-bin.000002 >$MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.000002 +--exec echo > $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp +perl; +open F, $ENV{'MYSQLTEST_VARDIR'}.'/tmp/rpl_rotate_logs.000002' or die "Tmp file rpl_rotate_logs.000002 not found"; +open F2, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/rpl_rotate_logs.tmp' or die "Tmp file rpl_rotate_logs.tmp not found"; +while () +{ + if (/Modify: ([^ ]*) ([^ ]*)\./) + { + printf F2 ("let \$tmpval = %s %s;",$1,$2); + } +} +close F; +close F2; +EOF + +--source $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp +remove_file $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.000002; +remove_file $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp; + --disable_result_log -select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) - from information_schema.tables - where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +--replace_result $tmpval tmpval +--eval SELECT @time_for_purge:=DATE_ADD('$tmpval', INTERVAL 1 SECOND) --enable_result_log purge master logs before (@time_for_purge);