From: Jon Olav Hauglid Date: June 17 2011 10:51am Subject: bzr commit into mysql-trunk branch (jon.hauglid:3219) Bug#12661349 List-Archive: http://lists.mysql.com/commits/139406 X-Bug: 12661349 Message-Id: <201106171051.p5HApkg0032429@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1989656553744433178==" --===============1989656553744433178== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #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 ; +# 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 +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); --===============1989656553744433178== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/jon.hauglid@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: jon.hauglid@stripped # target_branch: file:///export/home/x/mysql-trunk-bug12661349/ # testament_sha1: 95751be3e1ee98c9b9284c75b886df08b83cf61e # timestamp: 2011-06-17 12:51:37 +0200 # source_branch: file:///export/home/x/mysql-5.5/ # base_revision_id: jon.hauglid@stripped\ # c5bt1ybrftcdtmys # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWSvyekIAA5TfgEAQfXf//39/ /uD////wYAjvrzVSQAEJesV2xoBpSotAZIRpqT0aMpoz0pmhojTQaaABoGgGgaHGTJoxDTQwE0MT RpkxAyMJo00wgyYaoj1NPUAGmhoaZGg0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UVs4XmuVXY qBqJBfOITuL7AVmClaohUNAwAgc5lKiuHDUCcDiGQAz+4igojYUSEDOo0NXoQ4Eq0lVQ5OZDJj3n bLzAyFdwLTSYt3MEgGxNRkbkkvrviXrEmSCYefhrKLvBsGi9F+MH/IDEUrAcvvMstvxG50gROs7v LQoNkyC7ec3JkdE6IWWeQiXEbHlKfyrHA6viPGZMvsYZh0j9594jDPgdTTFLbvb/AMbY+eNUi3Ep I1Ym9YOtxyEmeUF5ofV5rXpAK1IoJZHQsuV1pw5UonrpfEGAqFJUOE6yx10OkvIrsHY9JShuWWAg blnBEllWAjYTZxvn1lcl1w2GZXGBZonqzrf1Voku001tQqFSxFK6M5oat5F1ttvUTmmCDQsvxahK tiyBmFAO4vXUGaEs2hin8aYxIJnMvpPKeed6gVSfSBwWw8RmiFW44uwg1lPQDIWyCG7YYYH1LAwg VgoFIzhWNXJqeJRZeyu/ur3F6R0YjlzVIngPFJPiw7lXSPQ6jfTj7e30j8U2CSbEwNsAxBi4PB73 xeWbMvCX2HFZqlzaubxe3kdrrzdcwntSMrB9W6pbpExaTEUsiJrYZlaImPcp+xWdRfaeZGBaFvuL pHYr/+LuSKcKEgV+T0hA --===============1989656553744433178==--