mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into bodhi.local:/opt/local/work/mysql-5.1-runtime include/my_global.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/events_scheduling.result: Auto merged BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8: Auto merged BitKeeper/deleted/.del-mysql_create_system_tables.sh: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/events_scheduling.test: Auto merged mysql-test/t/grant_cache.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/view.test: Auto merged scripts/mysql_system_tables_fix.sql: Auto merged sql/event_db_repository.cc: Auto merged sql/event_queue.cc: Auto merged sql/field.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/item_subselect.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_help.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/tztime.cc: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/ha_myisam.h: Auto merged mysql-test/r/skip_grants.result: Manualmerge. mysql-test/r/sp.result: Manualmerge. mysql-test/t/skip_grants.test: Manualmerge. mysql-test/t/sp.test: Manualmerge. sql/event_data_objects.cc: Manualmerge.
This commit is contained in:
@@ -65,8 +65,10 @@ struct event_queue_param
|
||||
static int
|
||||
event_queue_element_compare_q(void *vptr, byte* a, byte *b)
|
||||
{
|
||||
return my_time_compare(&((Event_queue_element *)a)->execute_at,
|
||||
&((Event_queue_element *)b)->execute_at);
|
||||
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
|
||||
my_time_t rhs = ((Event_queue_element *)b)->execute_at;
|
||||
|
||||
return (lhs < rhs ? -1 : (lhs > rhs ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +86,7 @@ Event_queue::Event_queue()
|
||||
{
|
||||
mutex_last_unlocked_in_func= mutex_last_locked_in_func=
|
||||
mutex_last_attempted_lock_in_func= "";
|
||||
set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME);
|
||||
next_activation_at= 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -497,15 +499,11 @@ Event_queue::dbug_dump_queue(time_t now)
|
||||
DBUG_PRINT("info", ("exec_at: %lu starts: %lu ends: %lu execs_so_far: %u "
|
||||
"expr: %ld et.exec_at: %ld now: %ld "
|
||||
"(et.exec_at - now): %d if: %d",
|
||||
(long) TIME_to_ulonglong_datetime(&et->execute_at),
|
||||
(long) TIME_to_ulonglong_datetime(&et->starts),
|
||||
(long) TIME_to_ulonglong_datetime(&et->ends),
|
||||
et->execution_count,
|
||||
(long) et->expression,
|
||||
(long) (sec_since_epoch_TIME(&et->execute_at)),
|
||||
(long) now,
|
||||
(int) (sec_since_epoch_TIME(&et->execute_at) - now),
|
||||
sec_since_epoch_TIME(&et->execute_at) <= now));
|
||||
(long) et->execute_at, (long) et->starts,
|
||||
(long) et->ends, et->execution_count,
|
||||
(long) et->expression, (long) et->execute_at,
|
||||
(long) now, (int) (et->execute_at - now),
|
||||
et->execute_at <= now));
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
#endif
|
||||
@@ -534,7 +532,6 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
|
||||
Event_queue_element_for_exec **event_name)
|
||||
{
|
||||
bool ret= FALSE;
|
||||
struct timespec top_time;
|
||||
*event_name= NULL;
|
||||
DBUG_ENTER("Event_queue::get_top_for_execution_if_time");
|
||||
|
||||
@@ -553,7 +550,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
|
||||
if (!queue.elements)
|
||||
{
|
||||
/* There are no events in the queue */
|
||||
set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME);
|
||||
next_activation_at= 0;
|
||||
|
||||
/* Wait on condition until signaled. Release LOCK_queue while waiting. */
|
||||
cond_wait(thd, NULL, queue_empty_msg, SCHED_FUNC, __LINE__);
|
||||
@@ -565,16 +562,15 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
|
||||
|
||||
thd->end_time(); /* Get current time */
|
||||
|
||||
time_t seconds_to_next_event=
|
||||
sec_since_epoch_TIME(&top->execute_at) - thd->query_start();
|
||||
next_activation_at= top->execute_at;
|
||||
if (seconds_to_next_event > 0)
|
||||
if (next_activation_at > thd->query_start())
|
||||
{
|
||||
/*
|
||||
Not yet time for top event, wait on condition with
|
||||
time or until signaled. Release LOCK_queue while waiting.
|
||||
*/
|
||||
set_timespec(top_time, seconds_to_next_event);
|
||||
struct timespec top_time;
|
||||
set_timespec(top_time, next_activation_at - thd->query_start());
|
||||
cond_wait(thd, &top_time, queue_wait_msg, SCHED_FUNC, __LINE__);
|
||||
|
||||
continue;
|
||||
@@ -752,10 +748,11 @@ Event_queue::dump_internal_status()
|
||||
printf("Last lock attempt at: %s:%u\n", mutex_last_attempted_lock_in_func,
|
||||
mutex_last_attempted_lock_at_line);
|
||||
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
|
||||
|
||||
TIME time;
|
||||
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
|
||||
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
|
||||
next_activation_at.year, next_activation_at.month,
|
||||
next_activation_at.day, next_activation_at.hour,
|
||||
next_activation_at.minute, next_activation_at.second);
|
||||
time.year, time.month, time.day, time.hour, time.minute, time.second);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user