List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:June 17 2011 10:51am
Subject:bzr commit into mysql-trunk branch (jon.hauglid:3219) Bug#12661349
View as plain text  
#At file:///export/home/x/mysql-trunk-bug12661349/ based on revid:jon.hauglid@stripped

 3219 Jon Olav Hauglid	2011-06-17
      Bug#12661349 Assert in protocol::end_statement
      
      The triggered assert checks that either OK or an error
      is sent to the client after a command has been processed
      by the server. It was triggered in this case if the client
      used binary protocol and the connection was killed during
      prepare. On release builds, the consequence of the bug was
      that OK was sent to the client even if the prepare failed.
      
      When processing a SQL command, a check towards end of
      processing makes sure to report KILL_QUERY error to the
      client if the connection/command was killed. This check
      was however not done for binary protocol processing
      (COM_STMT_PREPARE in this case).
      
      This patch fixes the problem by making sure that the 
      KILL_QUERY error is sent to the client in these cases
      as well.
      
      Test case added to ps.test.

    modified:
      mysql-test/r/ps.result
      mysql-test/t/ps.test
      sql/sql_parse.cc
=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2011-03-22 12:06:52 +0000
+++ b/mysql-test/r/ps.result	2011-06-17 10:51:25 +0000
@@ -3721,3 +3721,17 @@ FROM (SELECT 1 UNION SELECT 2) t;
 2
 #
 # End of 5.5 tests.
+#
+# Bug#12661349 assert in protocol::end_statement
+#
+# Note: This test case should be run with --ps-protocol
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (col1 INT);
+# Connection con1
+# Connection default
+KILL QUERY <con1_id>;
+# Connection con1
+SELECT * FROM t1;
+ERROR 70100: Query execution was interrupted
+# Connection default
+DROP TABLE t1;

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2011-03-22 12:06:52 +0000
+++ b/mysql-test/t/ps.test	2011-06-17 10:51:25 +0000
@@ -3328,3 +3328,37 @@ FROM (SELECT 1 UNION SELECT 2) t;
 --echo # End of 5.5 tests.
 
 ###########################################################################
+
+
+--echo #
+--echo # Bug#12661349 assert in protocol::end_statement
+--echo #
+
+--echo # Note: This test case should be run with --ps-protocol
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (col1 INT);
+
+--echo # Connection con1
+connect(con1, localhost, root);
+let $con1_id= `SELECT CONNECTION_ID()`;
+
+--echo # Connection default
+connection default;
+--replace_result $con1_id <con1_id>
+eval KILL QUERY $con1_id;
+
+--echo # Connection con1
+connection con1;
+# Here the server asserts when running with "--ps-protocol"
+--error ER_QUERY_INTERRUPTED
+SELECT * FROM t1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP TABLE t1;

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-06-16 16:06:32 +0000
+++ b/sql/sql_parse.cc	2011-06-17 10:51:25 +0000
@@ -1527,6 +1527,8 @@ bool dispatch_command(enum enum_server_c
 
   /* Finalize server status flags after executing a command. */
   thd->update_server_status();
+  if (thd->killed_errno() && !thd->get_stmt_da()->is_set())
+    thd->send_kill_message();
   thd->protocol->end_statement();
   query_cache_end_of_result(thd);
 


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20110617105125-61py38bpfl730b8f.bundle
Thread
bzr commit into mysql-trunk branch (jon.hauglid:3219) Bug#12661349Jon Olav Hauglid19 Jun