From d2b9c8c219f9a51485b55a02b698d1087ad8cc4a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 16:48:14 +0400 Subject: [PATCH] Fix an unstable test. mysql-test/r/log_tables.result: Update results. mysql-test/t/log_tables.test: Silence a race condition: TRUNCATE code issues mysql_frm_type without a metadata lock, and finds no table if hits the moment when ALTER is swapping two tables. --- mysql-test/r/log_tables.result | 29 +++++++++++++++++------------ mysql-test/t/log_tables.test | 30 ++++++++++++++++++------------ 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 39349183276..9e67d328849 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -415,6 +415,8 @@ use test// create procedure proc25422_truncate_slow (loops int) begin declare v1 int default 0; +declare continue handler for sqlexception /* errors from truncate */ +begin end; while v1 < loops do truncate mysql.slow_log; set v1 = v1 + 1; @@ -423,6 +425,8 @@ end// create procedure proc25422_truncate_general (loops int) begin declare v1 int default 0; +declare continue handler for sqlexception /* errors from truncate */ +begin end; while v1 < loops do truncate mysql.general_log; set v1 = v1 + 1; @@ -454,23 +458,24 @@ set global general_log = @old_log_state; set v1 = v1 + 1; end while; end// +set @iterations=100; "Serial test (proc25422_truncate_slow)" -call proc25422_truncate_slow(100); +call proc25422_truncate_slow(@iterations); "Serial test (proc25422_truncate_general)" -call proc25422_truncate_general(100); +call proc25422_truncate_general(@iterations); "Serial test (proc25422_alter_slow)" -call proc25422_alter_slow(100); +call proc25422_alter_slow(@iterations); "Serial test (proc25422_alter_general)" -call proc25422_alter_general(100); +call proc25422_alter_general(@iterations); "Parallel test" -call proc25422_truncate_slow(100); -call proc25422_truncate_slow(100); -call proc25422_truncate_general(100); -call proc25422_truncate_general(100); -call proc25422_alter_slow(100); -call proc25422_alter_slow(100); -call proc25422_alter_general(100); -call proc25422_alter_general(100); +call proc25422_truncate_slow(@iterations); +call proc25422_truncate_slow(@iterations); +call proc25422_truncate_general(@iterations); +call proc25422_truncate_general(@iterations); +call proc25422_alter_slow(@iterations); +call proc25422_alter_slow(@iterations); +call proc25422_alter_general(@iterations); +call proc25422_alter_general(@iterations); drop procedure proc25422_truncate_slow; drop procedure proc25422_truncate_general; drop procedure proc25422_alter_slow; diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 8baa4e5a373..89c7c255554 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -460,6 +460,8 @@ use test// create procedure proc25422_truncate_slow (loops int) begin declare v1 int default 0; + declare continue handler for sqlexception /* errors from truncate */ + begin end; while v1 < loops do truncate mysql.slow_log; set v1 = v1 + 1; @@ -469,6 +471,8 @@ end// create procedure proc25422_truncate_general (loops int) begin declare v1 int default 0; + declare continue handler for sqlexception /* errors from truncate */ + begin end; while v1 < loops do truncate mysql.general_log; set v1 = v1 + 1; @@ -507,14 +511,16 @@ end// delimiter ;// +set @iterations=100; + --echo "Serial test (proc25422_truncate_slow)" -call proc25422_truncate_slow(100); +call proc25422_truncate_slow(@iterations); --echo "Serial test (proc25422_truncate_general)" -call proc25422_truncate_general(100); +call proc25422_truncate_general(@iterations); --echo "Serial test (proc25422_alter_slow)" -call proc25422_alter_slow(100); +call proc25422_alter_slow(@iterations); --echo "Serial test (proc25422_alter_general)" -call proc25422_alter_general(100); +call proc25422_alter_general(@iterations); --echo "Parallel test" @@ -532,24 +538,24 @@ connect (addconroot7, localhost, root,,); connect (addconroot8, localhost, root,,); connection addconroot1; -send call proc25422_truncate_slow(100); +send call proc25422_truncate_slow(@iterations); connection addconroot2; -send call proc25422_truncate_slow(100); +send call proc25422_truncate_slow(@iterations); connection addconroot3; -send call proc25422_truncate_general(100); +send call proc25422_truncate_general(@iterations); connection addconroot4; -send call proc25422_truncate_general(100); +send call proc25422_truncate_general(@iterations); connection addconroot5; -send call proc25422_alter_slow(100); +send call proc25422_alter_slow(@iterations); connection addconroot6; -send call proc25422_alter_slow(100); +send call proc25422_alter_slow(@iterations); connection addconroot7; -send call proc25422_alter_general(100); +send call proc25422_alter_general(@iterations); connection addconroot8; -send call proc25422_alter_general(100); +send call proc25422_alter_general(@iterations); connection addconroot1; reap;