BUG 13454045 - 63524: BUG #35396 "ABNORMAL/IMPOSSIBLE/LARGE QUERY_TIME AND LOCK_TIME" HAPPENS A

If a query's end time is before before its start time, the system clock has been turn back
(daylight savings time etc.). When the system clock is changed, we can't tell for certain a
given query was actually slow. We did not protect against logging such a query with a bogus
execution time (resulting from end_time - start_time being negative), and possibly logging it
even though it did not really take long to run.

We now have a sanity check in place.
parent ae309bd3
...@@ -1734,8 +1734,9 @@ void log_slow_statement(THD *thd) ...@@ -1734,8 +1734,9 @@ void log_slow_statement(THD *thd)
ulonglong end_utime_of_query= thd->current_utime(); ulonglong end_utime_of_query= thd->current_utime();
thd_proc_info(thd, "logging slow query"); thd_proc_info(thd, "logging slow query");
if (((end_utime_of_query - thd->utime_after_lock) > if ((((end_utime_of_query > thd->utime_after_lock) &&
thd->variables.long_query_time || ((end_utime_of_query - thd->utime_after_lock) >
thd->variables.long_query_time)) ||
((thd->server_status & ((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes && opt_log_queries_not_using_indexes &&
......
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