Commit fa833a09 authored by Praveenkumar Hulakund's avatar Praveenkumar Hulakund

Bug#11745656 - KILL THREAD -> ERROR: "SERVER SHUTDOWN IN PROGRESS"

Description:
------------
There are 2 issues reported in the bug report,

1. One session running a "long" select, then, from the other
session, you kill that first one, while select is
running, and it receives that message "Server shutdown in
progress".
Reported Date: 02-Apr-2006

=> Looks like this isuse is already fixed in 2009 by the patch
   pushed for bug28141. 

2. Killing query which goes to filesort, logs error entries like:

120416  9:17:28 [ERROR] mysqld: Sort aborted: Server shutdown in
                                              progress 
120416  9:18:48 [ERROR] mysqld: Sort aborted: Server shutdown in
                                              progress 
120416  9:19:39 [ERROR] mysqld: Sort aborted: Server shutdown in
                                              progress 
Reported Date: 16-Apr-2012                                              

=> This issue is introduced in 5.5+ versions. Fixing this issue
   in this patch.


Analysis:
---------
In function "filesort()", on error we are logging error message.
To the error message, the message related THD::killed_errno is
also appeneded, if it is set.(THD::kill_errno value is obtained
by calling member function THD::killed_errno)

In the scenario mentioned in this bug report, when we kill the
connection, THD::kill_errno is set to the THD::KILL_CONNECTION.
Enum type THD::KILL_CONNECTION corressponds to value 
ER_SERVER_SHUTDOWN. Because of this, "Server shutdown in ...." is
appended to the message logged.

Fix:
----
Modified code of "filesort()" function to append "KILL_QUERY"
status to error message when thread is killed and server
shutdown is not in progress.
parent a1c6ddc8
...@@ -339,7 +339,10 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -339,7 +339,10 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
"%s: %s", "%s: %s",
MYF(ME_ERROR + ME_WAITTANG), MYF(ME_ERROR + ME_WAITTANG),
ER_THD(thd, ER_FILSORT_ABORT), ER_THD(thd, ER_FILSORT_ABORT),
kill_errno ? ER(kill_errno) : thd->stmt_da->message()); kill_errno ? ((kill_errno == THD::KILL_CONNECTION &&
!shutdown_in_progress) ? ER(THD::KILL_QUERY) :
ER(kill_errno)) :
thd->stmt_da->message());
if (global_system_variables.log_warnings > 1) if (global_system_variables.log_warnings > 1)
{ {
......
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