summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-11-12 15:56:21 +0300
committerKonstantin Osipov <kostja@sun.com>2010-11-12 15:56:21 +0300
commit4749b884942f464febbb8221b4a73f5b85e98090 (patch)
tree47b1a5ab7416e5cc83776aa9a0543a058f35d724 /sql/sql_parse.cc
parent936bec8e2cf0362e0cf8902ab1f7ea8141b880cc (diff)
downloadmariadb-git-4749b884942f464febbb8221b4a73f5b85e98090.tar.gz
Implement a fix for Bug#57058 -- send SERVER_QUERY_WAS_SLOW over
network when a query was slow. When a query is slow, sent a special flag to the client indicating this fact. Add a test case. Implement review comments.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e95745634e8..4f4e26d1df0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1438,8 +1438,7 @@ void log_slow_statement(THD *thd)
ulonglong end_utime_of_query= thd->current_utime();
thd_proc_info(thd, "logging slow query");
- if (((end_utime_of_query - thd->utime_after_lock) >
- thd->variables.long_query_time ||
+ if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes &&
@@ -5505,6 +5504,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
thd->end_statement();
thd->cleanup_after_query();
DBUG_ASSERT(thd->change_list.is_empty());
+ /* Finalize server status flags after executing a statement. */
+ thd->update_server_status();
}
DBUG_VOID_RETURN;