From 47d17e5d7f241153c3a3f6b3da7f8ba96f5f3046 Mon Sep 17 00:00:00 2001
From: unknown <anozdrin/alik@station.>
Date: Wed, 31 Oct 2007 12:04:19 +0300
Subject: [PATCH] Fix for a BUG#31649: events.test fails: NULL "state" field of
 SHOW PROCESSLIST.

The problem was a race condition: if the Event Scheduler was not
quick enough, the following scenario happens:
  - The Event Scheduler picks up the created event;
  - The event is executed;
  - event_scheduler_thread->proc_info is set to NULL;
  - The client issues SELECT FROM I_S.

The fix is to wait for the Event Scheduler to reach 'Waiting
for next activation' state.


mysql-test/t/events.test:
  Wait for the Event Scheduler to start waiting for the activation.
---
 mysql-test/t/events.test | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index d1ca5f1b609..a4c7eaebc30 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -454,7 +454,8 @@ create event 蟹邪泻邪褔泻邪 on schedule every 10 hour do select get_lock("test_l
 --echo "Should have only 2 processes: the scheduler and the locked event"
 let $wait_condition= select count(*) = 2 from information_schema.processlist
   where ( (state like 'User lock%' AND info like 'select get_lock%')
-       OR (command='Daemon' AND user='event_scheduler'));
+       OR (command='Daemon' AND user='event_scheduler' AND
+           state = 'Waiting for next activation'));
 --source include/wait_condition.inc
 
 select /*2*/ user, host, db, command, state, info
-- 
2.30.9