diff options
author | unknown <anozdrin/alik@station.> | 2007-11-15 15:35:35 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@station.> | 2007-11-15 15:35:35 +0300 |
commit | 91f001398654238fb98d7c82e1be18e11ef53138 (patch) | |
tree | d8b742889e9b1796277e17a4ef5fdf79756809dc /mysql-test/t/kill.test | |
parent | 26b5030487f92667c03bae8f8ab32f654f1de9c6 (diff) | |
download | mariadb-git-91f001398654238fb98d7c82e1be18e11ef53138.tar.gz |
A patch for BUG#19723: kill of active connection yields
different error code depending on platform.
On Mac OS X, KILL statement issued to kill the current
connection would return a different error code and message than on
other platforms ('MySQL server has gone away' instead of 'Shutdown
in progress').
The reason for this difference was that on Mac OS X we have macro
SIGNAL_WITH_VIO_CLOSE defined. This macro forces KILL
implementation to close the communication socket of the thread
that is being killed. SIGNAL_WITH_VIO_CLOSE macro is defined on
platforms where just sending a signal is not a reliable mechanism
to interrupt the thread from sleeping on a blocking system call.
In a nutshell, closing the socket is a hack to work around an
operating system bug and awake the blocked thread no matter what.
However, if the thread that is being killed is the same
thread that issued KILL statement, closing the socket leads to a
prematurely lost connection. At the same time it is not necessary
to close the socket in this case, since the thread in question
is not inside a blocking system call.
The fix, therefore, is to not close the socket if the thread that
is being killed is the same that issued KILL statement, even with
defined SIGNAL_WITH_VIO_CLOSE.
mysql-test/r/kill.result:
Update result file.
mysql-test/t/kill.test:
Added a test case for BUG#19723: kill of active connection yields
different error code depending on platform.
sql/sql_class.cc:
Call close_active_vio() only if we're killing another thread.
Diffstat (limited to 'mysql-test/t/kill.test')
-rw-r--r-- | mysql-test/t/kill.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 5d5095f7d61..219412e5afa 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -304,3 +304,19 @@ while ($i) dec $i ; } --enable_query_log + +########################################################################### + +--echo # +--echo # Bug#19723: kill of active connection yields different error code +--echo # depending on platform. +--echo # + +--echo +--echo # Connection: con2. +--connection con2 + +KILL CONNECTION_ID(); + +--error 2013 +SELECT 1; |