List:Commits« Previous MessageNext Message »
From:Horst Hunger Date:February 27 2009 6:43pm
Subject:bzr commit into mysql-5.1-bugteam branch (horst:2825) Bug#37962
View as plain text  
#At file:///work/bzr/mysql-5.1-37962/

 2825 Horst Hunger	2009-02-27
      Fix for bug#37962: Replace "sleeps" and race conditions. Following tests have been effected.
      
      delayed_insert_limit_func.test:
      Replaced the sleeps, adjusted the tests to have deterministic results when performance is low, beautifications.
      
      event_scheduler_func.test:
      Replaced the sleeps except one sleep that makes sense, beautifications.
      
      innodb_max_dirty_pages_pct_func.test:
      Replaced the sleeps with other fixes.
      
      interactive_timeout_func.test:
      Made the test stable, but as long as CLIENT_INTERACTIVE cannot be set when open a connection the timeout cannot be tested.
      
      query_cache_wlock_invalidate_func.test:
      Replaced the sleeps and added 2 more selects to see that they all will not be blocked.
      
      rpl_init_slave_func.test:
      Replaced the sleeps with other fixes.
      
      rpl_max_binlog_size_func.test:
      Replaced the sleep.
      
      slow_query_log_func.test:
      The sleeps are the long queries and cannot be replaced. Made the test deterministic.
      
      sql_low_priority_updates_func.test:
      Replaced the sleeps.
      
      timestamp_func.test:
      Replaced the sleeps with other fixes.
      
      wait_timeout_func.test:
      Replaced the sleeps with other fixes.
modified:
  mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result
  mysql-test/suite/sys_vars/r/event_scheduler_func.result
  mysql-test/suite/sys_vars/r/interactive_timeout_func.result
  mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
  mysql-test/suite/sys_vars/r/slow_query_log_func.result
  mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result
  mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
  mysql-test/suite/sys_vars/t/event_scheduler_func.test
  mysql-test/suite/sys_vars/t/interactive_timeout_func.test
  mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
  mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
  mysql-test/suite/sys_vars/t/slow_query_log_func.test
  mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test

=== modified file 'mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result'
--- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result	2009-02-27 18:43:52 +0000
@@ -3,98 +3,114 @@
 Creating connection con0
 Creating connection con1
 SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit;
-CREATE TABLE t1 (a varchar(100));
+CREATE TABLE t1 (a varchar(100),b varchar(100),c varchar(100));
 '#--------------------FN_DYNVARS_25_01-------------------------#'
-SET GLOBAL delayed_insert_limit = 9;
-** Connection con0 **
-SET GLOBAL delayed_insert_limit = 9;
-** Connection con1 **
-SET GLOBAL delayed_insert_limit = 9;
-** Connection default **
-SET GLOBAL delayed_insert_limit = 9;
-INSERT INTO t1 VALUES('1');
-INSERT INTO t1 VALUES('2');
-INSERT INTO t1 VALUES('3');
-INSERT INTO t1 VALUES('4');
-INSERT INTO t1 VALUES('5');
-INSERT INTO t1 VALUES('6');
+SET GLOBAL delayed_insert_limit = 14;
+INSERT INTO t1 VALUES('1','1','1');
+INSERT INTO t1 VALUES('2','1','1');
+INSERT INTO t1 VALUES('3','1','1');
+INSERT INTO t1 VALUES('4','1','1');
+INSERT INTO t1 VALUES('5','1','1');
+INSERT INTO t1 VALUES('6','1','1');
 LOCK TABLE t1 WRITE;
 ** Connection con1 **
-INSERT DELAYED INTO t1 VALUES('7');
-INSERT DELAYED INTO t1 VALUES('8');
-INSERT DELAYED INTO t1 VALUES('9');
-INSERT DELAYED INTO t1 VALUES('10');
-INSERT DELAYED INTO t1 VALUES('11');
-INSERT DELAYED INTO t1 VALUES('12');
-INSERT DELAYED INTO t1 VALUES('13');
-INSERT DELAYED INTO t1 VALUES('14');
-INSERT DELAYED INTO t1 VALUES('15');
-INSERT DELAYED INTO t1 VALUES('16');
-INSERT DELAYED INTO t1 VALUES('17');
-INSERT DELAYED INTO t1 VALUES('18');
-INSERT DELAYED INTO t1 VALUES('19');
-INSERT DELAYED INTO t1 VALUES('20');
-INSERT DELAYED INTO t1 VALUES('21');
-INSERT DELAYED INTO t1 VALUES('22');|
+INSERT DELAYED INTO t1 VALUES('7','1','1');
+INSERT DELAYED INTO t1 VALUES('8','1','1');
+INSERT DELAYED INTO t1 VALUES('9','1','1');
+INSERT DELAYED INTO t1 VALUES('10','1','1');
+INSERT DELAYED INTO t1 VALUES('11','1','1');
+INSERT DELAYED INTO t1 VALUES('12','1','1');
+INSERT DELAYED INTO t1 VALUES('13','1','1');
+INSERT DELAYED INTO t1 VALUES('14','1','1');
+INSERT DELAYED INTO t1 VALUES('15','1','1');
+INSERT DELAYED INTO t1 VALUES('16','1','1');
+INSERT DELAYED INTO t1 VALUES('17','1','1');
+INSERT DELAYED INTO t1 VALUES('18','1','1');
+INSERT DELAYED INTO t1 VALUES('19','1','1');
+INSERT DELAYED INTO t1 VALUES('20','1','1');
+INSERT DELAYED INTO t1 VALUES('21','1','1');
+INSERT DELAYED INTO t1 VALUES('22','1','1');
+INSERT DELAYED INTO t1 VALUES('23','1','1');
+INSERT DELAYED INTO t1 VALUES('24','1','1');
+INSERT DELAYED INTO t1 VALUES('25','1','1');
+INSERT DELAYED INTO t1 VALUES('26','1','1');
+INSERT DELAYED INTO t1 VALUES('27','1','1');
+INSERT DELAYED INTO t1 VALUES('28','1','1');
+INSERT DELAYED INTO t1 VALUES('29','1','1');
+INSERT DELAYED INTO t1 VALUES('30','1','1');
+INSERT DELAYED INTO t1 VALUES('31','1','1');
+INSERT DELAYED INTO t1 VALUES('32','1','1');
+INSERT DELAYED INTO t1 VALUES('33','1','1');
+INSERT DELAYED INTO t1 VALUES('34','1','1');
+INSERT DELAYED INTO t1 VALUES('35','1','1');
+INSERT DELAYED INTO t1 VALUES('36','1','1');
+INSERT DELAYED INTO t1 VALUES('37','1','1');
+INSERT DELAYED INTO t1 VALUES('38','1','1');
+INSERT DELAYED INTO t1 VALUES('39','1','1');
+INSERT DELAYED INTO t1 VALUES('40','1','1');
+INSERT DELAYED INTO t1 VALUES('41','1','1');
+INSERT DELAYED INTO t1 VALUES('42','1','1');
+INSERT DELAYED INTO t1 VALUES('43','1','1');|
 ** Connection con0 **
-SELECT * FROM t1;|
+SELECT count(*) BETWEEN 21 AND 43 FROM t1;|
 ** Connection default **
-Waiting for 1 sec
 UNLOCK TABLES;
+** Connection con1 **
 ** Connection con0 **
-a
+count(*) BETWEEN 21 AND 43
 1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
 'Bug#35386: insert delayed inserts 1 + limit rows instead of just limit rows'
 ** Connection default **
-Waiting for 1 sec
 Checking if the delayed insert continued afterwards
 SELECT * FROM t1;
-a
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
+a	b	c
+1	1	1
+2	1	1
+3	1	1
+4	1	1
+5	1	1
+6	1	1
+7	1	1
+8	1	1
+9	1	1
+10	1	1
+11	1	1
+12	1	1
+13	1	1
+14	1	1
+15	1	1
+16	1	1
+17	1	1
+18	1	1
+19	1	1
+20	1	1
+21	1	1
+22	1	1
+23	1	1
+24	1	1
+25	1	1
+26	1	1
+27	1	1
+28	1	1
+29	1	1
+30	1	1
+31	1	1
+32	1	1
+33	1	1
+34	1	1
+35	1	1
+36	1	1
+37	1	1
+38	1	1
+39	1	1
+40	1	1
+41	1	1
+42	1	1
+43	1	1
 DELETE FROM t1;
+DROP TABLE t1;
 '#--------------------FN_DYNVARS_25_02-------------------------#'
-SET GLOBAL delayed_insert_limit = 20;
-** Connection con0 **
-SET GLOBAL delayed_insert_limit = 20;
-** Connection con1 **
-SET GLOBAL delayed_insert_limit = 20;
-** Connection default **
+CREATE TABLE t1 (a varchar(100));
 SET GLOBAL delayed_insert_limit = 20;
 INSERT INTO t1 VALUES('1');
 INSERT INTO t1 VALUES('2');
@@ -123,37 +139,15 @@ INSERT DELAYED INTO t1 VALUES('21');
 INSERT DELAYED INTO t1 VALUES('22');|
 ** Connection con0 **
 Asynchronous execute
-SELECT * FROM t1;|
+SELECT count(*) BETWEEN 20 AND 22 FROM t1;|
 ** Connection default **
-Waiting for 1 sec
 UNLOCK TABLES;
+** Connection con1 **
 ** Connection con0 **
 Asynchronous execute result
-a
+count(*) BETWEEN 20 AND 22
 1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
 ** Connection default**
-Waiting for 1 sec
 Checking if the delayed insert gives the same result afterwards
 SELECT * FROM t1;
 a

=== modified file 'mysql-test/suite/sys_vars/r/event_scheduler_func.result'
--- a/mysql-test/suite/sys_vars/r/event_scheduler_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/event_scheduler_func.result	2009-02-27 18:43:52 +0000
@@ -1,4 +1,4 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Creating new table ##
 CREATE TABLE t1
 (
@@ -7,6 +7,7 @@ PRIMARY KEY (id),
 name VARCHAR(30)
 );
 '#--------------------FN_DYNVARS_018_01-------------------------#'
+SET @start_value= @@global.event_scheduler;
 ## Setting initial value of variable to ON ##
 SET @@global.event_scheduler = ON;
 SELECT @@event_scheduler;
@@ -16,14 +17,14 @@ ON
 CREATE EVENT test_event_1
 ON SCHEDULE EVERY 3 SECOND
 DO 
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
 SELECT * from t1;
 id	name
 1	Record_1
 2	Record_1
 DROP EVENT test_event_1;
-DELETE from t1;
-select * from t1;
+DELETE FROM t1;
+SELECT * FROM t1;
 id	name
 '#--------------------FN_DYNVARS_018_02-------------------------#'
 ## Setting value of variable to OFF ##
@@ -33,12 +34,16 @@ SELECT @@event_scheduler;
 OFF
 ## Creating new event ##
 CREATE EVENT test_event_1
-ON SCHEDULE EVERY 3 SECOND
+ON SCHEDULE EVERY 1 SECOND
 DO 
-INSERT into t1(name) values('Record_2');
+INSERT INTO t1(name) VALUES('Record_2');
+SELECT count(*) FROM information_schema.events WHERE event_name= 'test_event_1';
+count(*)
+1
 ## Table should be empty ##
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 DROP EVENT test_event_1;
 ## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
+SET @@global.event_scheduler= @start_value;

=== modified file 'mysql-test/suite/sys_vars/r/interactive_timeout_func.result'
--- a/mysql-test/suite/sys_vars/r/interactive_timeout_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/interactive_timeout_func.result	2009-02-27 18:43:52 +0000
@@ -9,7 +9,7 @@ name VARCHAR(30)
 '#--------------------FN_DYNVARS_052_01-------------------------#'
 ## Setting initial value of variable to 1 ##
 SET @@global.interactive_timeout = 1;
-## Creating new interactive connection test_con1 ## 
+## Creating new connection test_con1 ## 
 ## Inserting record in table ##
 INSERT into t1(name) values('Record_1');
 ## Setting session value of interactive_timeout ## 
@@ -21,10 +21,15 @@ SELECT @@session.interactive_timeout;
 SELECT @@global.interactive_timeout;
 @@global.interactive_timeout
 1
+connection default;
 ## Using sleep to check timeout ## 
+sleep 2;
+connection test_con1;
 SELECT * from t1;
 id	name
 1	Record_1
-'Bug#35377: Error should appear here because interactive_timeout value';
-'is 1 and connection remains idle for 5 secs';
 INSERT into t1(name) values('Record_2');
+connection default;
+disconnect test_con1;
+DROP TABLE t1;
+SET @@global.interactive_timeout= 28800;

=== modified file 'mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result'
--- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result	2009-02-27 18:43:52 +0000
@@ -53,7 +53,7 @@ LOCK TABLE t1 WRITE;
 ** Asynchronous Execution **
 SELECT * FROM t1;
 ** Connection con0 **
-Sleeping 2 Seconds before unlock
+wait until table is locked
 UNLOCK TABLES;
 ** Connection con1 **
 ** Asynchronous Result **
@@ -108,8 +108,17 @@ id	value
 1	val1
 2	val2
 3	val3
+SELECT * FROM t1;
+id	value
+1	val1
+2	val2
+3	val3
+SELECT * FROM t1;
+id	value
+1	val1
+2	val2
+3	val3
 ** Connection con0 **
-Sleeping 2 Seconds before unlock
 UNLOCK TABLES;
 ** Connection con1 **
 '#----------------------------FN_DYNVARS_136_05------------------------#'

=== modified file 'mysql-test/suite/sys_vars/r/slow_query_log_func.result'
--- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result	2009-02-27 18:43:52 +0000
@@ -17,8 +17,8 @@ TRUNCATE mysql.slow_log;
 SELECT sleep(2);
 sleep(2)
 0
-SELECT count(*) FROM mysql.slow_log;
-count(*)
+SELECT count(*) > 0 FROM mysql.slow_log;
+count(*) > 0
 1
 SET @@global.log_output = @global_log_output;
 SET @global.slow_query_log = @global_slow_query_log;

=== modified file 'mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result'
--- a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result	2009-02-27 18:43:52 +0000
@@ -29,7 +29,6 @@ LOCK TABLE t1 READ;
 SELECT * FROM t1;
 UNLOCK TABLES;|
 ** Connection default **
-Sleeping for 1 secs
 UNLOCK TABLES;
 ** Connection con0 **
 ** Asynchronous Result **
@@ -66,7 +65,6 @@ LOCK TABLE t1 READ;
 SELECT * FROM t1;
 UNLOCK TABLES;|
 ** Connection default **
-Sleeping for 1 secs
 UNLOCK TABLES;
 ** Connection con0 **
 ** Asynchronous Result **

=== modified file 'mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test'
--- a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test	2009-02-27 18:43:52 +0000
@@ -10,12 +10,15 @@
 #                                                                                       #
 # Creation Date: 2008-02-25                                                             #
 # Author:  Sharique Abdullah                                                            #
+# Modified: HHunger 2009-02-26 Replaced 2 sleeps by wait conditions,                    #
+#                              beautifications.                                         #
 #                                                                                       #
 # Description: Test Cases of Dynamic System Variable "sql_low_priority_updates"         #
 #              that checks behavior of this variable in the following ways              #
 #              * Functionality based on different values                                #
 #                                                                                       #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html                     #
+# Reference:                                                                            #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html                   #
 #                                                                                       #
 #########################################################################################
 
@@ -40,31 +43,18 @@ SET @global_delayed_insert_limit = @@GLO
 # Create Table
 #
 
-CREATE TABLE t1 (a varchar(100));
+CREATE TABLE t1 (a varchar(100),b varchar(100),c varchar(100));
 
 --echo '#--------------------FN_DYNVARS_25_01-------------------------#'
-#
-# Value less than the provided INSERTS (9)
-#
 
-SET GLOBAL delayed_insert_limit = 9;
-
---echo ** Connection con0 **
-connection con0;
-SET GLOBAL delayed_insert_limit = 9;
---echo ** Connection con1 **
-connection con1;
-SET GLOBAL delayed_insert_limit = 9;
---echo ** Connection default **
-connection default;
-SET GLOBAL delayed_insert_limit = 9;
+SET GLOBAL delayed_insert_limit = 14;
 
-INSERT INTO t1 VALUES('1');
-INSERT INTO t1 VALUES('2');
-INSERT INTO t1 VALUES('3');
-INSERT INTO t1 VALUES('4');
-INSERT INTO t1 VALUES('5');
-INSERT INTO t1 VALUES('6');
+INSERT INTO t1 VALUES('1','1','1');
+INSERT INTO t1 VALUES('2','1','1');
+INSERT INTO t1 VALUES('3','1','1');
+INSERT INTO t1 VALUES('4','1','1');
+INSERT INTO t1 VALUES('5','1','1');
+INSERT INTO t1 VALUES('6','1','1');
 
 LOCK TABLE t1 WRITE;
 
@@ -72,45 +62,63 @@ LOCK TABLE t1 WRITE;
 connection con1;
 
 delimiter |;
-
 send
-INSERT DELAYED INTO t1 VALUES('7');
-INSERT DELAYED INTO t1 VALUES('8');
-INSERT DELAYED INTO t1 VALUES('9');
-INSERT DELAYED INTO t1 VALUES('10');
-INSERT DELAYED INTO t1 VALUES('11');
-INSERT DELAYED INTO t1 VALUES('12');
-INSERT DELAYED INTO t1 VALUES('13');
-INSERT DELAYED INTO t1 VALUES('14');
-INSERT DELAYED INTO t1 VALUES('15');
-INSERT DELAYED INTO t1 VALUES('16');
-INSERT DELAYED INTO t1 VALUES('17');
-INSERT DELAYED INTO t1 VALUES('18');
-INSERT DELAYED INTO t1 VALUES('19');
-INSERT DELAYED INTO t1 VALUES('20');
-INSERT DELAYED INTO t1 VALUES('21');
-INSERT DELAYED INTO t1 VALUES('22');|
-
+INSERT DELAYED INTO t1 VALUES('7','1','1');
+INSERT DELAYED INTO t1 VALUES('8','1','1');
+INSERT DELAYED INTO t1 VALUES('9','1','1');
+INSERT DELAYED INTO t1 VALUES('10','1','1');
+INSERT DELAYED INTO t1 VALUES('11','1','1');
+INSERT DELAYED INTO t1 VALUES('12','1','1');
+INSERT DELAYED INTO t1 VALUES('13','1','1');
+INSERT DELAYED INTO t1 VALUES('14','1','1');
+INSERT DELAYED INTO t1 VALUES('15','1','1');
+INSERT DELAYED INTO t1 VALUES('16','1','1');
+INSERT DELAYED INTO t1 VALUES('17','1','1');
+INSERT DELAYED INTO t1 VALUES('18','1','1');
+INSERT DELAYED INTO t1 VALUES('19','1','1');
+INSERT DELAYED INTO t1 VALUES('20','1','1');
+INSERT DELAYED INTO t1 VALUES('21','1','1');
+INSERT DELAYED INTO t1 VALUES('22','1','1');
+INSERT DELAYED INTO t1 VALUES('23','1','1');
+INSERT DELAYED INTO t1 VALUES('24','1','1');
+INSERT DELAYED INTO t1 VALUES('25','1','1');
+INSERT DELAYED INTO t1 VALUES('26','1','1');
+INSERT DELAYED INTO t1 VALUES('27','1','1');
+INSERT DELAYED INTO t1 VALUES('28','1','1');
+INSERT DELAYED INTO t1 VALUES('29','1','1');
+INSERT DELAYED INTO t1 VALUES('30','1','1');
+INSERT DELAYED INTO t1 VALUES('31','1','1');
+INSERT DELAYED INTO t1 VALUES('32','1','1');
+INSERT DELAYED INTO t1 VALUES('33','1','1');
+INSERT DELAYED INTO t1 VALUES('34','1','1');
+INSERT DELAYED INTO t1 VALUES('35','1','1');
+INSERT DELAYED INTO t1 VALUES('36','1','1');
+INSERT DELAYED INTO t1 VALUES('37','1','1');
+INSERT DELAYED INTO t1 VALUES('38','1','1');
+INSERT DELAYED INTO t1 VALUES('39','1','1');
+INSERT DELAYED INTO t1 VALUES('40','1','1');
+INSERT DELAYED INTO t1 VALUES('41','1','1');
+INSERT DELAYED INTO t1 VALUES('42','1','1');
+INSERT DELAYED INTO t1 VALUES('43','1','1');|
 delimiter ;|
 
 --echo ** Connection con0 **
 connection con0;
-
+let $wait_condition= SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name like 'Not_flushed_delayed_rows';
+--source include/wait_condition.inc
 delimiter |;
-
 send
-SELECT * FROM t1;|
-
+SELECT count(*) BETWEEN 21 AND 43 FROM t1;|
 delimiter ;|
 
 --echo ** Connection default **
 connection default;
-
---echo Waiting for 1 sec
---sleep 1
-
 UNLOCK TABLES;
 
+--echo ** Connection con1 **
+connection con1;
+reap;
+
 --echo ** Connection con0 **
 connection con0;
 reap;
@@ -118,30 +126,20 @@ reap;
 
 --echo ** Connection default **
 connection default;
-
---echo Waiting for 1 sec
---sleep 1
+let $wait_condition= SELECT count(*) = 43 FROM t1;
+--source include/wait_condition.inc
 --echo Checking if the delayed insert continued afterwards
 SELECT * FROM t1;
 
 DELETE FROM t1;
 
+DROP TABLE t1;
 
---echo '#--------------------FN_DYNVARS_25_02-------------------------#'
-#
-# Value 5
-#
 
-SET GLOBAL delayed_insert_limit = 20;
+--echo '#--------------------FN_DYNVARS_25_02-------------------------#'
 
---echo ** Connection con0 **
-connection con0;
-SET GLOBAL delayed_insert_limit = 20;
---echo ** Connection con1 **
-connection con1;
-SET GLOBAL delayed_insert_limit = 20;
---echo ** Connection default **
-connection default;
+CREATE TABLE t1 (a varchar(100));
+ 
 SET GLOBAL delayed_insert_limit = 20;
 
 INSERT INTO t1 VALUES('1');
@@ -181,23 +179,22 @@ delimiter ;|
 
 --echo ** Connection con0 **
 connection con0;
-
+let $wait_condition= SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name like 'Not_flushed_delayed_rows';
+--source include/wait_condition.inc
 --echo Asynchronous execute
 delimiter |;
-
 send
-SELECT * FROM t1;|
-
+SELECT count(*) BETWEEN 20 AND 22 FROM t1;|
 delimiter ;|
 
 --echo ** Connection default **
 connection default;
-
---echo Waiting for 1 sec
---sleep 1
-
 UNLOCK TABLES;
 
+--echo ** Connection con1 **
+connection con1;
+reap;
+
 --echo ** Connection con0 **
 connection con0;
 --echo Asynchronous execute result
@@ -205,9 +202,8 @@ reap;
 
 --echo ** Connection default**
 connection default;
-
---echo Waiting for 1 sec
---sleep 1
+let $wait_condition= SELECT count(*) = 22 FROM t1;
+--source include/wait_condition.inc
 --echo Checking if the delayed insert gives the same result afterwards
 SELECT * FROM t1;
 
@@ -227,3 +223,4 @@ disconnect con1;
 DROP TABLE t1;
 
 SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit;
+

=== modified file 'mysql-test/suite/sys_vars/t/event_scheduler_func.test'
--- a/mysql-test/suite/sys_vars/t/event_scheduler_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/event_scheduler_func.test	2009-02-27 18:43:52 +0000
@@ -10,19 +10,21 @@
 #                                                                              #
 # Creation Date: 2008-03-17                                                    #
 # Author:  Salman Rawala                                                       #
+# Modified: HHunger 2009-02-26 Replaced 2 sleeps by wait conditions, except    #
+#                              the last sleep, beautifications.                #
 #                                                                              #
 # Description: Test Cases of Dynamic System Variable "event_scheduler"         #
 #              that checks functionality of this variable                      #
 #                                                                              #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                           #
-#    server-system-variables.html#option_mysqld_event_scheduler                #
+# Reference:                                                                   #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html          #
 #                                                                              #
 ################################################################################
 
 -- source include/not_embedded.inc
 
 --disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 #########################
@@ -43,6 +45,8 @@ name VARCHAR(30)
 #    its behavior
 ####################################################################
 
+SET @start_value= @@global.event_scheduler;
+
 --echo ## Setting initial value of variable to ON ##
 SET @@global.event_scheduler = ON;
 SELECT @@event_scheduler;
@@ -51,17 +55,21 @@ SELECT @@event_scheduler;
 CREATE EVENT test_event_1
 ON SCHEDULE EVERY 3 SECOND
 DO 
-  INSERT into t1(name) values('Record_1');
+  INSERT INTO t1(name) VALUES('Record_1');
 
---sleep 4
+# Wait until event_1 has been executed twice.
+let $wait_condition= SELECT count(*) = 2 FROM t1;
+--source include/wait_condition.inc
 
 SELECT * from t1;
 
 DROP EVENT test_event_1;
+# Wait until drop event has been finished.
+let $wait_condition= SELECT count(*) = 0 FROM information_schema.events WHERE event_name= 'test_event_1';
+--source include/wait_condition.inc
 
---sleep 1
-DELETE from t1;
-select * from t1;
+DELETE FROM t1;
+SELECT * FROM t1;
 
 
 --echo '#--------------------FN_DYNVARS_018_02-------------------------#'
@@ -76,16 +84,20 @@ SELECT @@event_scheduler;
 
 --echo ## Creating new event ##
 CREATE EVENT test_event_1
-ON SCHEDULE EVERY 3 SECOND
+ON SCHEDULE EVERY 1 SECOND
 DO 
-  INSERT into t1(name) values('Record_2');
+  INSERT INTO t1(name) VALUES('Record_2');
+SELECT count(*) FROM information_schema.events WHERE event_name= 'test_event_1';
 
+# Not replaced by wait_condition.
 --sleep 4
 
 --echo ## Table should be empty ##
-SELECT * from t1;
+SELECT * FROM t1;
 
 DROP EVENT test_event_1;
 --echo ## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
+
+SET @@global.event_scheduler= @start_value;
 

=== modified file 'mysql-test/suite/sys_vars/t/interactive_timeout_func.test'
--- a/mysql-test/suite/sys_vars/t/interactive_timeout_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test	2009-02-27 18:43:52 +0000
@@ -1,23 +1,26 @@
-############## mysql-test\t\interactive_timeout_func.test #####################
-#                                                                             #
-# Variable Name: interactive_timeout                                          #
-# Scope: GLOBAL | SESSION                                                     #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value:28800                                                         #
-# Minvalue: 1                                                                 #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-03-07                                                   #
-# Author:  Salman Rawala                                                      #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable interactive_timeout      #
-#              that checks the functionality of this variable                 #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
-#                                                                             #
-###############################################################################
+############## mysql-test\t\interactive_timeout_func.test ######################
+#                                                                              #
+# Variable Name: interactive_timeout                                           #
+# Scope: GLOBAL | SESSION                                                      #
+# Access Type: Dynamic                                                         #
+# Data Type: numeric                                                           #
+# Default Value:28800                                                          #
+# Minvalue: 1                                                                  #
+#                                                                              #
+#                                                                              #
+# Creation Date: 2008-03-07                                                    #
+# Author:  Salman Rawala                                                       #
+#                                                                              #
+# Description: Test Cases of Dynamic System Variable interactive_timeout       #
+#              that checks the functionality of this variable                  #
+# Modified: HHunger 2009-02-26 Inserted clean up, beautifications.             #
+#                              It is not yet possible to set CLIENT_INTERACIVE #
+#                              When connecting, so the test has not the        #
+#                              desired effect. See 'wait_timeout_func'.        #
+# Reference:                                                                   #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html          #
+#                                                                              #
+################################################################################
 
 
 --disable_warnings
@@ -42,12 +45,14 @@ name VARCHAR(30)
 #   Setting initial value of interactive_timeout to 1 and verifying its
 #   behavior
 #######################################################################
+let $start_value= `SELECT @@global.interactive_timeout`;
 
 --echo ## Setting initial value of variable to 1 ##
 SET @@global.interactive_timeout = 1;
 
---echo ## Creating new interactive connection test_con1 ## 
-connect (test_con1, localhost, root,);
+--echo ## Creating new connection test_con1 ## 
+# Not yet possible to set CLEAN_INTERACTIVE flag
+connect (test_con1, localhost, root,,,,,);
 connection test_con1;
 
 --echo ## Inserting record in table ##
@@ -60,11 +65,24 @@ SET @@session.interactive_timeout = 1;
 SELECT @@session.interactive_timeout;
 SELECT @@global.interactive_timeout;
 
+--echo connection default;
+connection default;
 --echo ## Using sleep to check timeout ## 
-sleep 5;
-SELECT * from t1;
+--echo sleep 2;
+sleep 2;
 
---echo 'Bug#35377: Error should appear here because interactive_timeout value';
---echo 'is 1 and connection remains idle for 5 secs';
+--echo connection test_con1;
+connection test_con1;
+SELECT * from t1;
 
 INSERT into t1(name) values('Record_2');
+
+--echo connection default;
+
+--echo disconnect test_con1;
+disconnect test_con1;
+connection default;
+DROP TABLE t1;
+
+eval SET @@global.interactive_timeout= $start_value;
+

=== modified file 'mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test'
--- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test	2009-02-27 18:43:52 +0000
@@ -10,6 +10,7 @@
 #                                                                                    #
 # Creation Date: 2008-02-21                                                          #
 # Author:  Sharique Abdullah                                                         #
+# Modified: HHunger 2009-02-27 Repalced sleeps, beautifications                      #
 #                                                                                    #
 # Description: Test Cases of Dynamic System Variable "query_cache_wlock_invalidate"  #
 #              that checks behavior of this variable in the following ways           #
@@ -18,8 +19,8 @@
 #              * Scope & Access method                                               #
 #              * Cache behaviors                                                     #
 #                                                                                    #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                                 #
-#            server-system-variables.html#option_mysqld_query_cache_wlock_invalidate #
+# Reference:                                                                         #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html                #
 #                                                                                    #
 ######################################################################################
 
@@ -29,6 +30,8 @@
 # Setup
 #
 
+--source include/not_embedded.inc
+
 # disabled due to differences in the result
 --disable_ps_protocol
 #
@@ -135,8 +138,9 @@ send SELECT * FROM t1;
 --echo ** Connection con0 **
 connection con0;
 
---echo Sleeping 2 Seconds before unlock
---sleep 2
+--echo wait until table is locked
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Locked';
+--source include/wait_condition.inc
 UNLOCK TABLES;
 
 --echo ** Connection con1 **
@@ -195,20 +199,17 @@ SELECT * FROM t1;
 
 --echo ** Connection con0 **
 connection con0;
-
 LOCK TABLE t1 WRITE;
 
 --echo ** Connection con1 **
 connection con1;
-
 --echo ** Should not be blocked **
 SELECT * FROM t1;
+SELECT * FROM t1;
+SELECT * FROM t1;
 
 --echo ** Connection con0 **
 connection con0;
-
---echo Sleeping 2 Seconds before unlock
---sleep 2
 UNLOCK TABLES;
 
 --echo ** Connection con1 **

=== modified file 'mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test'
--- a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test	2009-01-29 16:59:46 +0000
+++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test	2009-02-27 18:43:52 +0000
@@ -7,7 +7,6 @@ source include/have_log_bin.inc;
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 
-
 #==============================================================
 --echo '--- check if log file is rotated after 4096 bytes ----' 
 #==============================================================
@@ -24,8 +23,8 @@ INSERT INTO t1 VALUES ('mysql');
 dec $a;
 }
 --enable_query_log
-
---sleep 2
+let $wait_condition= select count(*) from t1;
+--source include/wait_condition.inc
 
 # if log file is not created then this will fail
 let $MYSQLD_DATADIR=`select @@datadir`;

=== modified file 'mysql-test/suite/sys_vars/t/slow_query_log_func.test'
--- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test	2009-02-27 18:43:52 +0000
@@ -1,4 +1,3 @@
-
 # save
 SET @global_slow_query_log = @@global.slow_query_log;
 SET @global_log_output = @@global.log_output;
@@ -16,6 +15,7 @@ SET @@global.log_output = 'TABLE';
 
 SET @@global.slow_query_log = OFF;
 TRUNCATE mysql.slow_log;
+# The sleep is the slow query
 SELECT sleep(2);
 
 SELECT count(*) FROM mysql.slow_log;
@@ -26,9 +26,10 @@ SELECT count(*) FROM mysql.slow_log;
 
 SET @@global.slow_query_log = ON;
 TRUNCATE mysql.slow_log;
+# The sleep is the slow query
 SELECT sleep(2);
 
-SELECT count(*) FROM mysql.slow_log;
+SELECT count(*) > 0 FROM mysql.slow_log;
 
 #restore
 SET @@global.log_output = @global_log_output;
@@ -37,3 +38,4 @@ SET @global.slow_query_log = @global_slo
 ###############################################################################
 # End of the functionality test for slow_query_log                            #
 ###############################################################################
+

=== modified file 'mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test'
--- a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test	2009-02-27 18:43:52 +0000
@@ -98,9 +98,8 @@ delimiter ;|
 --echo ** Connection default **
 connection default;
 
---echo Sleeping for 1 secs
---sleep 1
-
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Locked';
+--source include/wait_condition.inc
 UNLOCK TABLES;
 
 --echo ** Connection con0 **
@@ -166,9 +165,8 @@ delimiter ;|
 --echo ** Connection default **
 connection default;
 
---echo Sleeping for 1 secs
---sleep 1
-
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Locked';
+--source include/wait_condition.inc
 UNLOCK TABLES;
 
 --echo ** Connection con0 **

Thread
bzr commit into mysql-5.1-bugteam branch (horst:2825) Bug#37962Horst Hunger27 Feb