summaryrefslogtreecommitdiff
path: root/mysql-test/t/dirty_close.test
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-11-10 17:09:27 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-11-10 17:09:27 -0200
commit80582b000f5cd5f6dfb24bed45df907b2c96ab02 (patch)
tree7d7b2c23c7122f5a51de6981e2668f74529dce21 /mysql-test/t/dirty_close.test
parente26de1ca16d60870184a6a30504c02bce5c4070d (diff)
downloadmariadb-git-80582b000f5cd5f6dfb24bed45df907b2c96ab02.tar.gz
Backport of Bug#10374 to mysql-next-mr
------------------------------------------------------------ revno: 2597.37.3 revision-id: sp1r-davi@mysql.com/endora.local-20080328123626-16430 parent: sp1r-anozdrin/alik@quad.opbmk-20080327125300-11290 committer: davi@mysql.com/endora.local timestamp: Fri 2008-03-28 09:36:26 -0300 message: Bug#10374 GET_LOCK does not let connection to close on the server side if it's aborted The problem is that the server doesn't detect aborted connections which are waiting on a lock or sleeping (user sleep), wasting system resources for a connection that is already dead. The solution is to peek at the connection every five seconds to verify if the connection is not aborted. A aborted connection is detect by polling the connection socket for available data to be read or end of file and in case of eof, the wait is aborted and the connection killed. include/violite.h: Export vio_peek_read function. mysql-test/r/dirty_close.result: Add test case result for Bug#10374 mysql-test/t/dirty_close.test: Add test case for Bug#10374 sql/item_func.cc: While waiting for a condition to be signaled, check if the connection is not broken every INTERRUPT_INTERVAL seconds. sql/sql_class.cc: Add function which checks if the client connection was aborted. sql/sql_class.h: Add function prototype. vio/viosocket.c: Add poll and peek functions for Windows and Unix.
Diffstat (limited to 'mysql-test/t/dirty_close.test')
-rw-r--r--mysql-test/t/dirty_close.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test
index 1bbd53e8c06..17a729000e3 100644
--- a/mysql-test/t/dirty_close.test
+++ b/mysql-test/t/dirty_close.test
@@ -22,6 +22,38 @@ disconnect con2;
# End of 4.1 tests
+#
+# Bug#10374 GET_LOCK does not let connection to close on the server side if it's aborted
+#
+
+connection default;
+SELECT GET_LOCK("dangling", 0);
+connect(con1, localhost, root,,);
+connection con1;
+--send SELECT GET_LOCK('dangling', 3600);
+connection default;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
+ AND INFO = "SELECT GET_LOCK('dangling', 3600)";
+--source include/wait_condition.inc
+dirty_close con1;
+let $wait_condition=
+ SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
+ AND INFO = "SELECT GET_LOCK('dangling', 3600)";
+--source include/wait_condition.inc
+connect(con1, localhost, root,,);
+--send SELECT GET_LOCK('dangling', 3600);
+connection default;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
+ AND INFO = "SELECT GET_LOCK('dangling', 3600)";
+--source include/wait_condition.inc
+SELECT RELEASE_LOCK('dangling');
+connection con1;
+--reap
+connection default;
+disconnect con1;
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc