From 78fa2e4d6d89b8d0bb4b26fe648668b97c9400b9 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Fri, 12 Nov 2010 15:56:21 +0300 Subject: 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. include/mysql_com.h: Clear SERVER_QUERY_WAS_SLOW at end of each statement. Since this patch removes the technique when thd->server_status is modified briefly only to execute my_eof(), reset more server status bit that may remain in the status from execution of the previous statement. sql/protocol.cc: Always use thd->server_status to in net_* functions to send the latest status to the client. sql/sp_head.cc: Calculate if a query was slow before sending EOF packet. sql/sql_cursor.cc: Remove juggling with thd->server_status. The extra status bits are reset at start of the next statement. sql/sql_db.cc: Remove juggling with thd->server_status. The extra status bits are reset at start of the next statement. sql/sql_error.cc: Remove m_server_status member, it's not really part of the Diagnostics_area. sql/sql_error.h: Remove server_status member, it's not part of the Diagnostics_area. The associated hack is removed as well. sql/sql_parse.cc: Do not calculate if a query was slow twice. Use a status flag in thd->server_status. tests/mysql_client_test.c: Add a test case for Bug#57058. Check that the status is present at the client, when sent. --- sql/sql_error.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'sql/sql_error.cc') diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 8c038e10a1f..f042a7cd164 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -365,7 +365,6 @@ Diagnostics_area::set_ok_status(THD *thd, ulonglong affected_rows_arg, if (is_error() || is_disabled()) return; - m_server_status= thd->server_status; m_statement_warn_count= thd->warning_info->statement_warn_count(); m_affected_rows= affected_rows_arg; m_last_insert_id= last_insert_id_arg; @@ -395,7 +394,6 @@ Diagnostics_area::set_eof_status(THD *thd) if (is_error() || is_disabled()) return; - m_server_status= thd->server_status; /* If inside a stored procedure, do not return the total number of warnings, since they are not available to the client -- cgit v1.2.1