From 9a1e9de91f87e565224398ea020203e552d157a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 00:22:24 +0300 Subject: [PATCH] bug#22725 combining the final result variable in such way that either option of the test execution will yield zero. mysql-test/r/binlog_killed.result: results changed mysql-test/t/binlog_killed.test: there are two options for the test passing: 1. no rows inserted and the INSERT gets killed, then there is no INSERT query in binlog 2. all rows inserted, then INSERT gets to binlog and error_code is zero --- mysql-test/r/binlog_killed.result | 18 +++--------------- mysql-test/t/binlog_killed.test | 28 ++++++++++++---------------- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index 368df408cb8..60fc403aeb3 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -6,19 +6,7 @@ get_lock("a", 20) 1 reset master; insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); -select count(*) from t2 /* must be 3 */; -count(*) -3 -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) -is not null -1 -select @a like "%#%error_code=0%" /* must return 1 */; -@a like "%#%error_code=0%" -1 -select @a like "%insert into%" /* must return 1 */; -@a like "%insert into%" -1 +select @result /* must be zero either way */; +@result +0 drop table t1,t2,t3; diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index a5c9dea81ec..269362b5584 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -31,24 +31,12 @@ disable_abort_on_error; disable_query_log; disable_result_log; -while (`select count(*) from t2`) -{ - sleep 0.1; - dec $counter; - if (!$counter) - { - die("Waited too long for query to suceed"); - } -} eval kill query $ID; -enable_abort_on_error; -enable_query_log; -enable_result_log; connection con2; --error 0,ER_QUERY_INTERRUPTED reap; -select count(*) from t2 /* must be 3 */; +let $rows= `select count(*) from t2 /* must be 1 or 0 */`; --exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -56,8 +44,16 @@ eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval select @a like "%#%error_code=0%" /* must return 1 */; -eval select @a like "%insert into%" /* must return 1 */; +let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`; +let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`; +eval set @result= $rows-2*$error_code - $insert_binlogged; + +enable_abort_on_error; +enable_query_log; +enable_result_log; + +select @result /* must be zero either way */; + # the functions are either *insensitive* to killing or killing can cause # strange problmes with the error propagation out of SF's stack # Bug#27563, Bug#27565, BUG#24971 @@ -245,7 +241,7 @@ drop function bug27563; drop function bug27565; } -#system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; +system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; drop table t1,t2,t3;