Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey 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
1.2398 06/05/12 11:41:01 andrey@lmy004. +11 -0
small fixes for the fix for bug #17619 Scheduler race conditions
sql/mysqld.cc
1.555 06/05/12 11:40:52 andrey@lmy004. +2 -2
don't kill the scheduler, it has no meaning. we shut it down a bit later.
sql/event_timed.cc
1.53 06/05/12 11:40:52 andrey@lmy004. +8 -1
- more debug info
- set status DISABLED whenever needed.
sql/event_scheduler.h
1.2 06/05/12 11:40:52 andrey@lmy004. +1 -1
returns true of we have waited
sql/event_scheduler.cc
1.2 06/05/12 11:40:52 andrey@lmy004. +41 -31
more docs
fix event shutdown when the scheduler is suspended
sql/event.cc
1.41 06/05/12 11:40:51 andrey@lmy004. +4 -0
more debug info
mysql-test/t/events_scheduling.test
1.4 06/05/12 11:40:51 andrey@lmy004. +3 -3
improve the test (covers more)
mysql-test/t/events_microsec.test
1.3 06/05/12 11:40:51 andrey@lmy004. +5 -45
the events are loaded during server start from disk so on disk changes
make no sense during runtime. save 5s execution time
mysql-test/t/events_logs_tests.test
1.7 06/05/12 11:40:51 andrey@lmy004. +8 -7
save 5s execution time
mysql-test/r/events_scheduling.result
1.3 06/05/12 11:40:51 andrey@lmy004. +6 -3
update result
mysql-test/r/events_microsec.result
1.4 06/05/12 11:40:51 andrey@lmy004. +0 -46
update result
mysql-test/r/events_logs_tests.result
1.7 06/05/12 11:40:51 andrey@lmy004. +9 -8
update result
# 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: andrey
# Host: lmy004.
# Root: /work/mysql-5.1-bug17619-new-with_system_thread_fixed_bulk_drop
--- 1.554/sql/mysqld.cc 2006-05-11 16:41:06 +02:00
+++ 1.555/sql/mysqld.cc 2006-05-12 11:40:52 +02:00
@@ -863,8 +863,8 @@ static void close_connections(void)
{
DBUG_PRINT("quit",("Informing thread %ld that it's time to die",
tmp->thread_id));
- /* We skip slave threads on this first loop through. */
- if (tmp->slave_thread)
+ /* We skip slave threads & scheduler on this first loop through. */
+ if (tmp->slave_thread || tmp->system_thread == SYSTEM_THREAD_EVENT_SCHEDULER)
continue;
tmp->killed= THD::KILL_CONNECTION;
--- 1.3/mysql-test/r/events_microsec.result 2006-05-11 16:31:44 +02:00
+++ 1.4/mysql-test/r/events_microsec.result 2006-05-12 11:40:51 +02:00
@@ -10,50 +10,4 @@ CREATE EVENT micro_test ON SCHEDULE EVER
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-"Now create normal event and change it on SQL level"
-CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
-UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
-SHOW CREATE EVENT micro_test2;
-ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-SET GLOBAL event_scheduler=0;
-"Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-Variable_name Value
-event_scheduler OFF
-UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
-SHOW CREATE EVENT micro_test2;
-ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-SET GLOBAL event_scheduler=0;
-"Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-Variable_name Value
-event_scheduler OFF
-UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
-SHOW CREATE EVENT micro_test2;
-ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-SET GLOBAL event_scheduler=0;
-"Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-Variable_name Value
-event_scheduler OFF
-UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
-SHOW CREATE EVENT micro_test2;
-ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-SET GLOBAL event_scheduler=0;
-"Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-Variable_name Value
-event_scheduler OFF
-UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
-SHOW CREATE EVENT micro_test2;
-ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
-SET GLOBAL event_scheduler=0;
-"Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-Variable_name Value
-event_scheduler OFF
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
-COUNT(*)
-1
-DROP EVENT micro_test2;
drop database events_test;
--- 1.2/mysql-test/r/events_scheduling.result 2006-04-24 11:12:04 +02:00
+++ 1.3/mysql-test/r/events_scheduling.result 2006-05-12 11:40:51 +02:00
@@ -14,7 +14,7 @@ ENDS NOW() + INTERVAL 6 SECOND
ON COMPLETION PRESERVE
DO INSERT INTO table_2 VALUES(1);
CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
-CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1);
+CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
@@ -38,9 +38,12 @@ DROP EVENT start_n_end;
"Already dropped because ended. Therefore an error."
DROP EVENT only_one_time;
ERROR HY000: Unknown event 'only_one_time'
-"Already dropped because ended. Therefore an error."
+"Should be preserved"
+SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS;
+EVENT_NAME STATUS
+E19170 ENABLED
+two_time DISABLED
DROP EVENT two_time;
-ERROR HY000: Unknown event 'two_time'
DROP TABLE table_1;
DROP TABLE table_2;
DROP TABLE table_3;
--- 1.6/mysql-test/r/events_logs_tests.result 2006-04-24 11:12:04 +02:00
+++ 1.7/mysql-test/r/events_logs_tests.result 2006-05-12 11:40:51 +02:00
@@ -36,14 +36,14 @@ SELECT user_host, query_time, db, sql_te
user_host query_time db sql_text
"Set new values"
SET GLOBAL long_query_time=4;
-SET SESSION long_query_time=2;
+SET SESSION long_query_time=1;
"Check that logging is working"
-SELECT SLEEP(3);
-SLEEP(3)
+SELECT SLEEP(2);
+SLEEP(2)
0
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
-root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(3)
+root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(2)
TRUNCATE mysql.slow_log;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
"This won't go to the slow log"
@@ -64,18 +64,19 @@ SELECT user_host, query_time, db, sql_te
user_host query_time db sql_text
"This should go to the slow log"
SET SESSION long_query_time=10;
+SET GLOBAL long_query_time=1;
DROP EVENT long_event;
-CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5);
+CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
"Sleep some more time than the actual event run will take"
"Check our table. Should see 2 rows"
SELECT * FROM slow_event_test;
slo_val val
4 0
-4 0
-"Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10"
+1 0
+"Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text
-root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5)
+root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
DROP EVENT long_event2;
SET GLOBAL long_query_time =@old_global_long_query_time;
SET SESSION long_query_time =@old_session_long_query_time;
--- 1.2/mysql-test/t/events_microsec.test 2006-02-24 15:28:10 +01:00
+++ 1.3/mysql-test/t/events_microsec.test 2006-05-12 11:40:51 +02:00
@@ -1,55 +1,15 @@
create database if not exists events_test;
use events_test;
---error 1235
+--error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
---error 1235
+--error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
---error 1235
+--error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
---error 1235
+--error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
---error 1235
+--error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
-
---echo "Now create normal event and change it on SQL level"
-CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
-UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
---error 1235
-SHOW CREATE EVENT micro_test2;
-SET GLOBAL event_scheduler=0;
---sleep 1
---echo "Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
---error 1235
-SHOW CREATE EVENT micro_test2;
-SET GLOBAL event_scheduler=0;
---sleep 1
---echo "Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
---error 1235
-SHOW CREATE EVENT micro_test2;
-SET GLOBAL event_scheduler=0;
---sleep 1
---echo "Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
---error 1235
-SHOW CREATE EVENT micro_test2;
-SET GLOBAL event_scheduler=0;
---sleep 1
---echo "Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
---error 1235
-SHOW CREATE EVENT micro_test2;
-SET GLOBAL event_scheduler=0;
---sleep 1
---echo "Should not be running:"
-SHOW VARIABLES like 'event_scheduler';
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
-DROP EVENT micro_test2;
drop database events_test;
--- 1.3/mysql-test/t/events_scheduling.test 2006-04-24 11:12:04 +02:00
+++ 1.4/mysql-test/t/events_scheduling.test 2006-05-12 11:40:51 +02:00
@@ -15,7 +15,7 @@ CREATE EVENT start_n_end
DO INSERT INTO table_2 VALUES(1);
--sleep 5
CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
-CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1);
+CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
--sleep 5
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
@@ -28,8 +28,8 @@ DROP EVENT start_n_end;
--echo "Already dropped because ended. Therefore an error."
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT only_one_time;
---echo "Already dropped because ended. Therefore an error."
---error ER_EVENT_DOES_NOT_EXIST
+--echo "Should be preserved"
+SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS;
DROP EVENT two_time;
DROP TABLE table_1;
DROP TABLE table_2;
--- 1.6/mysql-test/t/events_logs_tests.test 2006-04-24 11:12:04 +02:00
+++ 1.7/mysql-test/t/events_logs_tests.test 2006-05-12 11:40:51 +02:00
@@ -53,10 +53,10 @@ TRUNCATE mysql.slow_log;
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "Set new values"
SET GLOBAL long_query_time=4;
-SET SESSION long_query_time=2;
+SET SESSION long_query_time=1;
--echo "Check that logging is working"
-SELECT SLEEP(3);
---replace_regex /00:00:0[3-5]/SLEEPVAL/
+SELECT SLEEP(2);
+--replace_regex /00:00:0[2-4]/SLEEPVAL/
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
TRUNCATE mysql.slow_log;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
@@ -73,14 +73,15 @@ SELECT * FROM slow_event_test;
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "This should go to the slow log"
SET SESSION long_query_time=10;
+SET GLOBAL long_query_time=1;
DROP EVENT long_event;
-CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5);
+CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
--echo "Sleep some more time than the actual event run will take"
---sleep 7
+--sleep 3
--echo "Check our table. Should see 2 rows"
SELECT * FROM slow_event_test;
---echo "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10"
---replace_regex /00:00:0[5-7]/SLEEPVAL/
+--echo "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
+--replace_regex /00:00:0[2-4]/SLEEPVAL/
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
DROP EVENT long_event2;
SET GLOBAL long_query_time =@old_global_long_query_time;
--- 1.40/sql/event.cc 2006-05-11 17:08:29 +02:00
+++ 1.41/sql/event.cc 2006-05-12 11:40:51 +02:00
@@ -569,8 +569,12 @@ evex_db_find_event_by_name(THD *thd, con
if (table->file->index_read_idx(table->record[0], 0, key,
table->key_info->key_length,HA_READ_KEY_EXACT))
+ {
+ DBUG_PRINT("info", ("Row not fonud"));
DBUG_RETURN(EVEX_KEY_NOT_FOUND);
+ }
+ DBUG_PRINT("info", ("Row found!"));
DBUG_RETURN(0);
}
--- 1.1/sql/event_scheduler.cc 2006-05-11 16:31:48 +02:00
+++ 1.2/sql/event_scheduler.cc 2006-05-12 11:40:52 +02:00
@@ -34,6 +34,19 @@
#define UNLOCK_SCHEDULER_DATA() unlock_data(__FUNCTION__,__LINE__)
+#ifndef DBUG_OFF
+static
+LEX_STRING states_names[] =
+{
+ {(char*) STRING_WITH_LEN("UNINITIALIZED")},
+ {(char*) STRING_WITH_LEN("INITIALIZED")},
+ {(char*) STRING_WITH_LEN("COMMENCING")},
+ {(char*) STRING_WITH_LEN("CANTSTART")},
+ {(char*) STRING_WITH_LEN("RUNNING")},
+ {(char*) STRING_WITH_LEN("IN_SHUTDOWN")}
+};
+#endif
+
class Worker_thread_param
{
public:
@@ -381,7 +394,10 @@ event_worker_thread(void *arg)
the in-memory queue and we hold the only reference
*/
if (flags & EVENT_FREE_WHEN_FINISHED)
+ {
+ DBUG_PRINT("info", ("Freeing object pointer"));
delete event;
+ }
}
if (thd)
@@ -1103,17 +1119,16 @@ Event_scheduler::run(THD *thd)
sql_print_information("SCHEDULER: Manager thread started with id %lu",
thd->thread_id);
abstime.tv_nsec= 0;
- while (state == RUNNING && (!thd->killed || !shutdown_in_progress))
+ while (state == RUNNING)
{
TIME time_now_utc;
Event_timed *et;
my_bool tmp;
time_t now_utc;
- DBUG_PRINT("info", ("thd->killed=%d shutdown_in_progress=%d",
- thd->killed, shutdown_in_progress));
LOCK_SCHEDULER_DATA();
- check_n_wait_for_non_empty_queue(thd);
+ if (check_n_wait_for_non_empty_queue(thd))
+ continue;
/* On TRUE data is unlocked, go back to the beginning */
if (check_n_suspend_if_needed(thd))
@@ -1132,7 +1147,6 @@ Event_scheduler::run(THD *thd)
/* Skip disabled events */
if (et->status != MYSQL_EVENT_ENABLED)
{
- DBUG_ASSERT(0);
sql_print_error("SCHEDULER: Found a disabled event %*s.%*s in the queue",
et->dbname.length, et->dbname.str, et->name.length,
et->name.str);
@@ -1285,14 +1299,19 @@ Event_scheduler::execute_top(THD *thd)
DBUG_PRINT("evex manager", ("[%10s] next exec at [%llu]", et->name.str,
TIME_to_ulonglong_datetime(&et->execute_at)));
- et->update_fields(thd);
-
/*
1. For one-time event : year is > 0 and expression is 0
2. For recurring, expression is != -=> check execute_at_null in this case
*/
if ((et->execute_at.year && !et->expression) || et->execute_at_null)
- et->flags |= EVENT_EXEC_NO_MORE;
+ {
+ sql_print_information("SCHEDULER: [%s.%s of %s] no more executions after "
+ "this one", et->dbname.str, et->name.str,
+ et->definer.str);
+ et->flags |= EVENT_EXEC_NO_MORE | EVENT_FREE_WHEN_FINISHED;
+ }
+
+ et->update_fields(thd);
if ((et->flags & EVENT_EXEC_NO_MORE) || et->status == MYSQL_EVENT_DISABLED)
queue_remove(&queue, 0);// 0 is top, internally 1
@@ -1491,8 +1510,7 @@ Event_scheduler::shutdown(bool acquire_l
DBUG_ENTER("Event_scheduler::shutdown");
DBUG_PRINT("enter", ("thd=%p", current_thd));
- if (acquire_lock)
- LOCK_SCHEDULER_DATA();
+ LOCK_SCHEDULER_DATA();
if (state != RUNNING)
{
DBUG_PRINT("info", ("manager not running but %d. doing nothing", state));
@@ -1514,6 +1532,8 @@ Event_scheduler::shutdown(bool acquire_l
for this shutdown procedure but better not.
*/
pthread_cond_signal(&cond_vars[COND_new_work]);
+ /* Or we are suspended - then we should wake up */
+ pthread_cond_signal(&cond_vars[COND_suspend_or_resume]);
/* Guarantee we don't catch spurious signals */
sql_print_information("SCHEDULER: Waiting the manager thread to reply");
@@ -1525,8 +1545,7 @@ Event_scheduler::shutdown(bool acquire_l
cond_wait(COND_shutdown, &LOCK_scheduler_data);
}
DBUG_PRINT("info", ("Manager thread has cleaned up. Set state to INIT"));
- if (acquire_lock)
- UNLOCK_SCHEDULER_DATA();
+ UNLOCK_SCHEDULER_DATA();
DBUG_RETURN(OP_OK);
}
@@ -1679,7 +1698,7 @@ Event_scheduler::check_n_suspend_if_need
was_suspended= true;
scheduler_working= false;
}
- while (suspended && state == RUNNING && !thd->killed && !shutdown_in_progress)
+ while (suspended && state == RUNNING)
{
cond_wait(COND_suspend_or_resume, &LOCK_scheduler_data);
DBUG_PRINT("info", ("Woke up after waiting on COND_suspend_or_resume"));
@@ -1706,11 +1725,15 @@ Event_scheduler::check_n_suspend_if_need
Event_scheduler::check_n_wait_for_non_empty_queue()
thd Thread
+ RETURN
+ FALSE Did not wait - LOCK_scheduler_data still locked.
+ TRUE Waited - LOCK_scheduler_data unlocked.
+
NOTE
The caller should have locked LOCK_scheduler_data!
*/
-void
+bool
Event_scheduler::check_n_wait_for_non_empty_queue(THD *thd)
{
bool slept= false;
@@ -1723,7 +1746,7 @@ Event_scheduler::check_n_wait_for_non_em
"Empty queue, sleeping");
/* Wait in a loop protecting against catching spurious signals */
- while (!queue.elements && !thd->killed && state == RUNNING && !suspended)
+ while (!queue.elements && state == RUNNING && !suspended)
{
slept= true;
DBUG_PRINT("info", ("Entering condition because of empty queue"));
@@ -1737,14 +1760,12 @@ Event_scheduler::check_n_wait_for_non_em
*/
}
if (slept)
- {
thd->exit_cond("");
- LOCK_SCHEDULER_DATA();
- }
+
DBUG_PRINT("exit", ("q.elements=%lu state=%d suspended=%d thd->killed=%d",
queue.elements, state, suspended, thd->killed));
- DBUG_VOID_RETURN;
+ DBUG_RETURN(slept);
}
@@ -1809,7 +1830,7 @@ Event_scheduler::cond_wait(enum Event_sc
{
int ret;
DBUG_ENTER("Event_scheduler::cond_wait");
- DBUG_PRINT("enter", ("cond_wait=%d mutex_wait=%p", cond, mutex));
+ DBUG_PRINT("enter", ("cond=%s mutex=%p", cond_vars_names[cond], mutex));
ret= pthread_cond_wait(&cond_vars[cond_waiting_on=cond], mutex);
cond_waiting_on= COND_NONE;
DBUG_RETURN(ret);
@@ -2097,17 +2118,6 @@ Event_scheduler::check_system_tables()
#ifndef DBUG_OFF
-static
-LEX_STRING states_names[] =
-{
- {(char*) STRING_WITH_LEN("UNINITIALIZED")},
- {(char*) STRING_WITH_LEN("INITIALIZED")},
- {(char*) STRING_WITH_LEN("COMMENCING")},
- {(char*) STRING_WITH_LEN("CANTSTART")},
- {(char*) STRING_WITH_LEN("RUNNING")},
- {(char*) STRING_WITH_LEN("IN_SHUTDOWN")}
-};
-
/*
Dumps some data about the internal status of the scheduler.
--- 1.1/sql/event_scheduler.h 2006-05-11 16:31:49 +02:00
+++ 1.2/sql/event_scheduler.h 2006-05-12 11:40:52 +02:00
@@ -169,7 +169,7 @@ protected:
bool
check_n_suspend_if_needed(THD *thd);
- void
+ bool
check_n_wait_for_non_empty_queue(THD *thd);
--- 1.52/sql/event_timed.cc 2006-05-11 17:08:29 +02:00
+++ 1.53/sql/event_timed.cc 2006-05-12 11:40:52 +02:00
@@ -946,12 +946,15 @@ Event_timed::compute_next_execution_time
/* There was previous execution */
if (my_time_compare(&ends, &next_exec) == -1)
{
- DBUG_PRINT("info", ("Next execution after ENDS. Stop executing."));
+ DBUG_PRINT("info", ("Next execution of %s after ENDS. Stop executing.",
+ name.str));
/* Next execution after ends. No more executions */
set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME);
execute_at_null= TRUE;
if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP)
dropped= true;
+ status= MYSQL_EVENT_DISABLED;
+ status_changed= true;
}
else
{
@@ -1042,6 +1045,8 @@ Event_timed::compute_next_execution_time
DBUG_PRINT("info", ("Next execution after ENDS. Stop executing."));
set_zero_time(&execute_at, MYSQL_TIMESTAMP_DATETIME);
execute_at_null= TRUE;
+ status= MYSQL_EVENT_DISABLED;
+ status_changed= true;
if (on_completion == MYSQL_EVENT_ON_COMPLETION_DROP)
dropped= true;
}
@@ -1623,6 +1628,8 @@ Event_timed::spawn_thread_finish(THD *th
in_spawned_thread= false;
DBUG_PRINT("info", ("Sending COND_finished for thread %d", thread_id));
thread_id= 0;
+ if (dropped)
+ drop(thd);
pthread_cond_signal(&COND_finished);
VOID(pthread_mutex_unlock(&LOCK_running));
DBUG_VOID_RETURN;
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2398) BUG#17619 | ahristov | 12 May |