From: Tor Didriksen Date: February 24 2011 7:18am Subject: bzr push into mysql-trunk branch (tor.didriksen:3708 to 3709) List-Archive: http://lists.mysql.com/commits/131990 Message-Id: <20110224071843.E33AE3793@atum07.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3709 Tor Didriksen 2011-02-24 [merge] merge 5.5 => trunk modified: mysql-test/r/filesort_debug.result mysql-test/t/filesort_debug.test sql/filesort.cc 3708 Vasil Dimov 2011-02-23 [merge] Merge mysql-5.5 -> mysql-trunk === modified file 'mysql-test/r/filesort_debug.result' --- a/mysql-test/r/filesort_debug.result 2011-02-02 13:41:10 +0000 +++ b/mysql-test/r/filesort_debug.result 2011-02-24 07:18:03 +0000 @@ -26,3 +26,20 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1 ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1 DROP TABLE t1; DROP FUNCTION f1; +# +# Bug #11747102 +# 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES +# +# connection 1 +CREATE TABLE t1(f0 int auto_increment primary key, f1 int); +INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); +SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed'; +# Sending: (not reaped since connection is killed later) +SELECT * FROM t1 ORDER BY f1 ASC, f0; +# connection 2 +SET DEBUG_SYNC='now WAIT_FOR filesort_started'; +KILL @id; +SET DEBUG_SYNC='now SIGNAL filesort_killed'; +# connection default +SET DEBUG_SYNC= "RESET"; +DROP TABLE t1; === modified file 'mysql-test/t/filesort_debug.test' --- a/mysql-test/t/filesort_debug.test 2011-02-02 13:41:10 +0000 +++ b/mysql-test/t/filesort_debug.test 2011-02-24 07:18:03 +0000 @@ -1,4 +1,6 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc SET @old_debug= @@session.debug; @@ -38,3 +40,37 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1 DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # Bug #11747102 +--echo # 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES +--echo # + +connect (con1, localhost, root); +connect (con2, localhost, root); + +--echo # connection 1 +connection con1; +CREATE TABLE t1(f0 int auto_increment primary key, f1 int); +INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); + +let $ID= `SELECT @id := CONNECTION_ID()`; + +SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed'; +--echo # Sending: (not reaped since connection is killed later) +--send SELECT * FROM t1 ORDER BY f1 ASC, f0 + +--echo # connection 2 +connection con2; +let $ignore= `SELECT @id := $ID`; +SET DEBUG_SYNC='now WAIT_FOR filesort_started'; +KILL @id; +SET DEBUG_SYNC='now SIGNAL filesort_killed'; + +--echo # connection default +connection default; +disconnect con1; +disconnect con2; +--source include/wait_until_count_sessions.inc +SET DEBUG_SYNC= "RESET"; +DROP TABLE t1; === modified file 'sql/filesort.cc' --- a/sql/filesort.cc 2011-02-02 13:41:10 +0000 +++ b/sql/filesort.cc 2011-02-24 07:18:03 +0000 @@ -35,6 +35,7 @@ #include "bounded_queue.h" #include "filesort_utils.h" #include "sql_select.h" +#include "debug_sync.h" #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class Bounded_queue; @@ -164,6 +165,7 @@ ha_rows filesort(THD *thd, TABLE *table, Item_subselect *subselect= tab ? tab->containing_subselect() : 0; MYSQL_FILESORT_START(table->s->db.str, table->s->table_name.str); + DEBUG_SYNC(thd, "filesort_start"); /* Release InnoDB's adaptive hash index latch (if holding) before @@ -357,12 +359,13 @@ ha_rows filesort(THD *thd, TABLE *table, } if (error) { - DBUG_ASSERT(thd->is_error()); + int kill_errno= thd->killed_errno(); + DBUG_ASSERT(thd->is_error() || kill_errno); my_printf_error(ER_FILSORT_ABORT, "%s: %s", MYF(ME_ERROR + ME_WAITTANG), ER_THD(thd, ER_FILSORT_ABORT), - thd->stmt_da->message()); + kill_errno ? ER(kill_errno) : thd->stmt_da->message()); if (global_system_variables.log_warnings > 1) { No bundle (reason: useless for push emails).