List:Commits« Previous MessageNext Message »
From:kroki Date:January 19 2007 12:17pm
Subject:bk commit into 5.1 tree (kroki:1.2403) BUG#25211
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomash. When tomash does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-19 15:17:39+03:00, kroki@stripped +4 -0
  BUG#25211: events_bugs.test fails on sapsrv1
  
  The problem was that the events_bugs test could randomly fail due to
  races in the test case.
  
  The solution is to replace fixed sleeps with reliable polling of a
  certain state to settle.  For that, a new auxiliary script
  include/wait_condition.inc is used, that allows waiting for a given
  query to return true.

  mysql-test/include/wait_condition.inc@stripped, 2007-01-19 15:17:36+03:00, kroki@stripped +39 -0
    New BitKeeper file ``mysql-test/include/wait_condition.inc''

  mysql-test/include/wait_condition.inc@stripped, 2007-01-19 15:17:36+03:00, kroki@stripped +0 -0

  mysql-test/include/wait_until_rows_count.inc@stripped, 2007-01-19 15:17:36+03:00, kroki@stripped +9 -41
    Script is rewritten using new include/wait_condition.inc.

  mysql-test/r/events_bugs.result@stripped, 2007-01-19 15:17:36+03:00, kroki@stripped +1 -1
    Update result: add missing quotation mark.

  mysql-test/t/events_bugs.test@stripped, 2007-01-19 15:17:36+03:00, kroki@stripped +42 -7
    Replace --sleep with the reliable waiting for a certain state.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kroki
# Host:	moonlight.home
# Root:	/home/tomash/src/mysql_ab/mysql-5.1-bug25211

--- 1.1/mysql-test/include/wait_until_rows_count.inc	2007-01-19 15:17:47 +03:00
+++ 1.2/mysql-test/include/wait_until_rows_count.inc	2007-01-19 15:17:47 +03:00
@@ -1,52 +1,20 @@
 # include/wait_until_rows_count.inc
-# inspired by wait_for_slave_status by Matthias Leich
 #
 # SUMMARY
 #
-#    Waits until SELECT count(*)-$count from $table returns zero
+#    Waits until SELECT count(*) = $count from $table returns true, or
+#    the operation times out.
 #
 # USAGE
 #
-#    Set vars like
-#      let $count=11;
-#      let $table=t1;
-#      # invoke the macro
-#      --include wait_until_rows_count.inc
+#    let $count= 5;
+#    let $table= t1;
+#    --source include/wait_until_rows_count.inc
 #
 # EXAMPLE
-# extra/binlog/binlog_insert_delayed.test
+#    extra/binlog/binlog_insert_delayed.test
 #
-#
-# TODO: generalize up to wait_[until|while] with arbitrary select or even query and
-#       a condition to wait or get awakened
-#       It's impossible to implement such a "most" general macro without
-#       extending mysqltest. Just no way to pass a query as an argument and
-#       evaluate it here, like eval "$quuery". One is bound
-#       to specify it inside of the macro
-
---disable_query_log
-
-let $wait_counter= 300;     # max wait in 0.1 seconds
-while ($wait_counter)
-{
-    eval select count(*)-$count from $table into @rez;
-    let $rez=`select @rez`;
-    let $success=`SELECT @rez = 0`;
-    let $no_success=1;
-    if ($success)
-    {
-        let $wait_counter= 1; # droppping counter to leave loop
-        let $no_success=0;
-    }
-    if ($no_success)
-    {
-       --sleep 0.1
-    }
-    dec $wait_counter;
-}
 
---enable_query_log
-if ($no_success)
-{
-	--die Timeout in wait_until_rows_count.inc, required table never had a prescribed number of rows.
-}
+let $wait_condition=
+  select count(*) = $count from $table;
+--source include/wait_condition.inc

--- 1.23/mysql-test/r/events_bugs.result	2007-01-19 15:17:47 +03:00
+++ 1.24/mysql-test/r/events_bugs.result	2007-01-19 15:17:47 +03:00
@@ -49,7 +49,7 @@ begin
 select get_lock('test_bug16407', 60);
 drop table "hashed_num";
 end|
-"Now if everything is fine the event has compiled and is locked
+"Now if everything is fine the event has compiled and is locked"
 select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
 user	host	db	info
 root	localhost	events_test	select get_lock('test_bug16407', 60)

--- 1.22/mysql-test/t/events_bugs.test	2007-01-19 15:17:47 +03:00
+++ 1.23/mysql-test/t/events_bugs.test	2007-01-19 15:17:47 +03:00
@@ -78,8 +78,13 @@ begin
   drop table "hashed_num";
 end|
 delimiter ;|
---sleep 0.8
---echo "Now if everything is fine the event has compiled and is locked
+
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where info = 'select get_lock(\'test_bug16407\', 60)';
+--source include/wait_condition.inc
+
+--echo "Now if everything is fine the event has compiled and is locked"
 select /*1*/ user, host, db, info from information_schema.processlist where command!='Daemon' and (info is null or info not like '%processlist%') order by info;
 select release_lock('test_bug16407');
 
@@ -127,10 +132,22 @@ begin
 end|
 delimiter ;|
 select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
---sleep 1
+
+let $wait_condition=
+  select count(*) = 3 from information_schema.processlist
+  where info = 'select get_lock(\'ee_16407_2\', 60)';
+--source include/wait_condition.inc
+
 select /*2*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
 select release_lock('ee_16407_2');
---sleep 1.2
+
+let $wait_condition=
+  select count(*) = 1 and user = 'event_scheduler' and info is null
+  from information_schema.processlist
+  where (command!='Daemon' || user='event_scheduler')
+  and (info is null or info not like '%processlist%');
+--source include/wait_condition.inc
+
 select /*3*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
 set global event_scheduler= off;
 select * from events_smode_test order by ev_name, a;
@@ -150,6 +167,7 @@ set global event_scheduler= on;
 
 set sql_mode='traditional';
 delimiter |;
+# ee_16407_5_pendant() should not insert anything because of invalid date.
 create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
 create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
 create event ee_16407_5 on schedule every 60 second do
@@ -165,11 +183,23 @@ begin
   call events_test.ee_16407_6_pendant();
 end|
 delimiter ;|
---sleep 1
+
+let $wait_condition=
+  select count(*) = 2 from information_schema.processlist
+  where info = 'select get_lock(\'ee_16407_5\', 60)';
+--source include/wait_condition.inc
+
 --echo "Should have 2 locked processes"
 select /*4*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
 select release_lock('ee_16407_5');
---sleep 1.3
+
+let $wait_condition=
+  select count(*) = 1 and user = 'event_scheduler' and info is null
+  from information_schema.processlist
+  where (command!='Daemon' || user='event_scheduler')
+  and (info is null or info not like '%processlist%');
+--source include/wait_condition.inc
+
 --echo "Should have 0 processes locked"
 select /*5*/ user, host, db, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
 select * from events_smode_test order by ev_name, a;
@@ -280,7 +310,12 @@ create event e22830_3 on schedule every 
 create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour;
 select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
 set global event_scheduler=on;
---sleep 4
+
+let $wait_condition=
+  select group_concat(interval_value order by interval_value) = '1,1,1,8'
+  from information_schema.events;
+--source include/wait_condition.inc
+
 set global event_scheduler=off;
 select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
 drop function f22830;
--- New file ---
+++ mysql-test/include/wait_condition.inc	07/01/19 15:17:36
# include/wait_condition.inc
#
# SUMMARY
#
#    Waits until the passed statement returns true, or the operation
#    times out.
#
# USAGE
#
#    let $wait_condition=
#      SELECT c = 3 FROM t;
#    --source include/wait_condition.inc
#
# EXAMPLE
#    events_bugs.test
#

--disable_query_log

let $wait_counter= 300;
while ($wait_counter)
{
    let $success= `$wait_condition`;
    if ($success)
    {
        let $wait_counter= 0;
    }
    if (!$success)
    {
        real_sleep 0.1;
        dec $wait_counter;
    }
}
if (!$success)
{
  echo Timeout in wait_condiniton.inc for $wait_condition;
}

--enable_query_log

Thread
bk commit into 5.1 tree (kroki:1.2403) BUG#25211kroki19 Jan