Commit afcf7bc7 authored by Davi Arnaut's avatar Davi Arnaut

Bug#57058: SERVER_QUERY_WAS_SLOW not wired up.

Finalize the server flags after any kind of command is executed.
To avoid updating the flag multiple times, reorganize code so that
its invoked only once for each command.
parent b23c19e8
...@@ -3353,6 +3353,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, ...@@ -3353,6 +3353,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
if (!parser_state.init(thd, thd->query(), thd->query_length())) if (!parser_state.init(thd, thd->query(), thd->query_length()))
{ {
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
log_slow_statement(thd); log_slow_statement(thd);
} }
......
...@@ -1034,11 +1034,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1034,11 +1034,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) && while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
! thd->is_error()) ! thd->is_error())
{ {
char *beginning_of_next_stmt= (char*)
parser_state.m_lip.found_semicolon;
/* /*
Multiple queries exits, execute them individually Multiple queries exits, execute them individually
*/ */
char *beginning_of_next_stmt= (char*) parser_state.m_lip.found_semicolon;
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
thd->protocol->end_statement(); thd->protocol->end_statement();
query_cache_end_of_result(thd); query_cache_end_of_result(thd);
ulong length= (ulong)(packet_end - beginning_of_next_stmt); ulong length= (ulong)(packet_end - beginning_of_next_stmt);
...@@ -1384,6 +1386,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1384,6 +1386,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(thd->open_tables == NULL || (thd->open_tables == NULL ||
(thd->locked_tables_mode == LTM_LOCK_TABLES))); (thd->locked_tables_mode == LTM_LOCK_TABLES)));
/* Finalize server status flags after executing a command. */
thd->update_server_status();
thd->protocol->end_statement(); thd->protocol->end_statement();
query_cache_end_of_result(thd); query_cache_end_of_result(thd);
...@@ -5504,8 +5508,6 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -5504,8 +5508,6 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
thd->end_statement(); thd->end_statement();
thd->cleanup_after_query(); thd->cleanup_after_query();
DBUG_ASSERT(thd->change_list.is_empty()); DBUG_ASSERT(thd->change_list.is_empty());
/* Finalize server status flags after executing a statement. */
thd->update_server_status();
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
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