Commit c10865e9 authored by andrey@lmy004's avatar andrey@lmy004

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into lmy004.:/work/mysql-5.1-new-clean
parents 5ec05822 48027b2d
...@@ -731,7 +731,9 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec, ...@@ -731,7 +731,9 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
get the next exec if the modulus is not get the next exec if the modulus is not
*/ */
DBUG_PRINT("info", ("multiplier=%d", multiplier)); DBUG_PRINT("info", ("multiplier=%d", multiplier));
if (seconds_diff % seconds || (!seconds_diff && last_exec->year)) if (seconds_diff % seconds || (!seconds_diff && last_exec->year) ||
TIME_to_ulonglong_datetime(time_now) ==
TIME_to_ulonglong_datetime(last_exec))
++multiplier; ++multiplier;
interval.second= seconds * multiplier; interval.second= seconds * multiplier;
DBUG_PRINT("info", ("multiplier=%u interval.second=%u", multiplier, DBUG_PRINT("info", ("multiplier=%u interval.second=%u", multiplier,
...@@ -893,16 +895,15 @@ Event_timed::compute_next_execution_time() ...@@ -893,16 +895,15 @@ Event_timed::compute_next_execution_time()
DBUG_PRINT("info", ("Both STARTS & ENDS are set")); DBUG_PRINT("info", ("Both STARTS & ENDS are set"));
if (!last_executed.year) if (!last_executed.year)
{ {
DBUG_PRINT("info", ("Not executed so far. Execute NOW.")); DBUG_PRINT("info", ("Not executed so far."));
execute_at= time_now;
execute_at_null= FALSE;
} }
else
{ {
TIME next_exec; TIME next_exec;
DBUG_PRINT("info", ("Executed at least once")); DBUG_PRINT("info", ("Executed at least once"));
if (get_next_time(&next_exec, &starts, &time_now, &last_executed, if (get_next_time(&next_exec, &starts, &time_now,
last_executed.year? &last_executed:&starts,
expression, interval)) expression, interval))
goto err; goto err;
...@@ -925,8 +926,9 @@ Event_timed::compute_next_execution_time() ...@@ -925,8 +926,9 @@ Event_timed::compute_next_execution_time()
} }
goto ret; goto ret;
} }
else if (starts_null && ends_null) else if (starts_null && ends_null)
{ {
/* starts is always set, so this is a dead branch !! */
DBUG_PRINT("info", ("Neither STARTS nor ENDS are set")); DBUG_PRINT("info", ("Neither STARTS nor ENDS are set"));
/* /*
Both starts and m_ends are not set, so we schedule for the next Both starts and m_ends are not set, so we schedule for the next
...@@ -961,25 +963,26 @@ Event_timed::compute_next_execution_time() ...@@ -961,25 +963,26 @@ Event_timed::compute_next_execution_time()
Hence schedule for starts + m_expression in case last_executed Hence schedule for starts + m_expression in case last_executed
is not set, otherwise to last_executed + m_expression is not set, otherwise to last_executed + m_expression
*/ */
if (last_executed.year) if (!last_executed.year)
{
DBUG_PRINT("info", ("Not executed so far."));
}
{ {
TIME next_exec; TIME next_exec;
DBUG_PRINT("info", ("Executed at least once.")); DBUG_PRINT("info", ("Executed at least once."));
if (get_next_time(&next_exec, &starts, &time_now, &last_executed, if (get_next_time(&next_exec, &starts, &time_now,
last_executed.year? &last_executed:&starts,
expression, interval)) expression, interval))
goto err; goto err;
execute_at= next_exec; execute_at= next_exec;
DBUG_PRINT("info",("Next[%llu]",TIME_to_ulonglong_datetime(&next_exec))); DBUG_PRINT("info",("Next[%llu]",TIME_to_ulonglong_datetime(&next_exec)));
} }
else
{
DBUG_PRINT("info", ("Not executed so far. Execute at STARTS"));
execute_at= starts;
}
execute_at_null= FALSE; execute_at_null= FALSE;
} }
else else
{ {
/* this is a dead branch, because starts is always set !!! */
DBUG_PRINT("info", ("STARTS is not set. ENDS is set")); DBUG_PRINT("info", ("STARTS is not set. ENDS is set"));
/* /*
- m_ends is set - m_ends is set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment