summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-15 18:20:58 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-17 00:16:15 +0100
commite86580c3dda707788fb0ca35244cf602d7e8d50d (patch)
treede04dc8446f1d12a9f2eb6c24f2215a11347ff0b /sql/sp_head.cc
parent211cf9321a91b12eaef3d7968adc699085dbb54e (diff)
downloadmariadb-git-e86580c3dda707788fb0ca35244cf602d7e8d50d.tar.gz
MDEV-11552 Queries executed by event scheduler are written to slow log incorrectly or not written at all
because thd->update_server_status() is used to measure the query time for the slow log (not only to set protocol level flags), it needs to be called also when the server isn't going to send anything to the client.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 019e9d9a478..9bfa60a07d3 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -3146,18 +3146,18 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
thd->query_length()) <= 0)
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
+ bool log_slow= !res && thd->enable_slow_log;
- if (thd->stmt_da->is_eof())
- {
- /* Finalize server status flags after executing a statement. */
+ /* Finalize server status flags after executing a statement. */
+ if (log_slow || thd->stmt_da->is_eof())
thd->update_server_status();
+ if (thd->stmt_da->is_eof())
thd->protocol->end_statement();
- }
query_cache_end_of_result(thd);
- if (!res && unlikely(thd->enable_slow_log))
+ if (log_slow)
log_slow_statement(thd);
}
else