List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:January 10 2011 1:27pm
Subject:bzr push into mysql-5.5 branch (jon.hauglid:3227 to 3228) Bug#58933
View as plain text  
 3228 Jon Olav Hauglid	2011-01-10
      Bug #58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
                 OPTIMIZE TABLE
      
      OPTIMIZE TABLE for InnoDB tables is handled as recreate + analyze.
      The triggered assert checked that an error had been reported if either
      recreate or analyze failed. However the assert failed to take into
      account that they could have failed because OPTIMIZE TABLE had been
      victim of KILL QUERY, KILL CONNECTION or server shutdown.
      
      This patch adjusts the assert to take this possibility into account.
      The problem was only noticeable on debug versions of the server.
      
      Test case added to innodb_mysql_sync.test.

    modified:
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/t/innodb_mysql_sync.test
      sql/sql_admin.cc
 3227 Magne Mahre	2011-01-10
      Bug#58970 Problem Subquery (without referencing a table) 
                and Order By
            
      When having a UNION statement in a subquery, with no
      referenced tables (or only a reference to the virtual
      table 'dual'), the UNION did not allow an ORDER BY clause.
            
            i.e:
                SELECT(SELECT 1 AS a UNION 
                       SELECT 0 AS a 
                       ORDER BY a) AS b  or
                SELECT(SELECT 1 AS a FROM dual UNION 
                       SELECT 0 as a 
                       ORDER BY a) AS b
            
            
      In addition, an ORDER BY / LIMIT clause was not accepted
      in subqueries even for single SELECT statements with no 
      referenced tables (or with 'dual' as table reference)
            
         i.e: 
            SELECT(SELECT 1 AS a ORDER BY a) AS b  or
            SELECT(SELECT 1 AS a FROM dual ORDER BY a) AS b
            
      The fix was to allow an optional ORDER BY/LIMIT clause to
      the grammar for these cases.
            
      See also: Bug#57986

    modified:
      mysql-test/r/union.result
      mysql-test/t/union.test
      sql/sql_yacc.yy
=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2010-06-25 07:07:18 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2011-01-10 13:12:23 +0000
@@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2;
 KILL @id;
 SET DEBUG_SYNC= "now SIGNAL killed";
 DROP TABLE t1, t2;
+SET DEBUG_SYNC= "RESET";
+#
+# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
+#           OPTIMIZE TABLE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+# Connection con1
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR waiting';
+KILL QUERY ID;
+SET DEBUG_SYNC= 'now SIGNAL killed';
+# Connection con1
+# Reaping: OPTIMIZE TABLE t1
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	status	Operation failed
+# Connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2010-06-25 07:07:18 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2011-01-10 13:12:23 +0000
@@ -104,6 +104,47 @@ SELECT ((@id := id) - id) FROM t2;
 KILL @id;
 SET DEBUG_SYNC= "now SIGNAL killed";
 DROP TABLE t1, t2;
+disconnect con1;
+--source include/wait_until_count_sessions.inc
+SET DEBUG_SYNC= "RESET";
+
+
+--echo #
+--echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
+--echo #           OPTIMIZE TABLE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+
+--echo # Connection con1
+connect (con1,localhost,root);
+let $ID= `SELECT connection_id()`;
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
+--echo # Sending:
+--send OPTIMIZE TABLE t1
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR waiting';
+--replace_result $ID ID
+eval KILL QUERY $ID;
+SET DEBUG_SYNC= 'now SIGNAL killed';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: OPTIMIZE TABLE t1
+--reap
+
+--echo # Connection default
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+disconnect con1;
 
 
 # Check that all connections opened by test cases in this file are really

=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2010-11-11 17:11:05 +0000
+++ b/sql/sql_admin.cc	2011-01-10 13:12:23 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -728,7 +728,7 @@ send_result_message:
       protocol->store(operator_name, system_charset_info);
       if (result_code) // either mysql_recreate_table or analyze failed
       {
-        DBUG_ASSERT(thd->is_error());
+        DBUG_ASSERT(thd->is_error() || thd->killed);
         if (thd->is_error())
         {
           const char *err_msg= thd->stmt_da->message();

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5 branch (jon.hauglid:3227 to 3228) Bug#58933Jon Olav Hauglid10 Jan