From: Jon Olav Hauglid Date: July 7 2010 1:20pm Subject: bzr commit into mysql-trunk-runtime branch (jon.hauglid:3077) Bug#37521 List-Archive: http://lists.mysql.com/commits/113028 X-Bug: 37521 Message-Id: <201007071320.o67Cjgq0014196@rcsinet13.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6710846979611996202==" --===============6710846979611996202== 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-runtime-bug37521/ based on revid:jon.hauglid@stripped 3077 Jon Olav Hauglid 2010-07-07 Bug #37521 Row inserted through view not always visible in base table immediately after The problem was that rows inserted in a table by one connection was not immediately visible if another connection queried the table, even if the insert had committed. The reason for the problem was that the server sent a status reply to the client before it actually did the commit. Therefore it was possible to get an OK from the server before the changes were made permanent and visible to other connections. This patch fixes the problem by not sending status messages to the server until any changes made have been committed. No test case added as reproducing the error requires very specific timing betweeen the server and two or more clients. This patch also fixes the following (duplicate) bugs: Bug #29334 pseudo-finished SHOW GLOBAL STATUS Bug #36618 myisam insert not immediately visible to select from another client Bug #45864 insert on one connection, immediate query on another produces no result Bug #51329 Inserts from one connection not immediately visible in second connection Bug #41516 Assertion fails when error returned from handler::external_lock(thd, F_UNLCK) modified: sql/sql_parse.cc === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc 2010-07-01 13:53:46 +0000 +++ b/sql/sql_parse.cc 2010-07-07 13:20:07 +0000 @@ -1511,13 +1511,13 @@ bool dispatch_command(enum enum_server_c thd->transaction.stmt.reset(); - thd->protocol->end_statement(); - query_cache_end_of_result(thd); - thd->proc_info= "closing tables"; /* Free tables */ close_thread_tables(thd); + thd->protocol->end_statement(); + query_cache_end_of_result(thd); + if (!thd->is_error() && !thd->killed_errno()) mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0); --===============6710846979611996202== 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-runtime-bug37521/ # testament_sha1: 05e8b78ddbeb4ed6452ce85f690d2700d519fa64 # timestamp: 2010-07-07 15:20:11 +0200 # base_revision_id: jon.hauglid@stripped\ # 1bbofu9atrundyrg # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWvViygAAf3fgACQWGf//3v9 noC////wUAXm1b26Ol7vdtZ7mt2vBu7HDIhAEwGU0mymp6TTPVA0eUaDNIekASiCNMQaRT8jVPT0 gg00aNAA0BpoDITFGpiNNU9JoeSep7VGQ00GmmgaaNABiSGTVPU2TUNPJNMgNDQGjTQGgaZAkkE0 0JT2TKYAptT2VPUZBoAAABS/8TmrZGnLj5h17OXfO142XY5d3lzFgFKCZAZMdzW59LWc7EuUf3YQ HEeJN+Xh1IiG7yF7YkqQwdaxzVwiv+23DppFbOqmDps2drDgm/tnuSx44+Sx3qsIb7FZAlFYJncr dz64cflY2BDJjUrGJPms73Iwu6+Vr5RuFixtpZCBFGyqbgjh5SRWaLSBbl+A0WC0VrR002RxJowv gcLTDQuy9iuWcLB5pVHn5dV7EYqGIkVF03aYy62MwtN6UEOQdFuGMlO+FUJcRPoCzEJLBuo0AISh IwSZkGg9gTYGkPE8QyRSOHsDLNKAtbCIC0whlT495I6G1JpmQSbe4SovQlDmZWCTYwzMrmzRrsMP dZWYPWBQFMZGZ16MTiggyJoLebP2ikyAmihyuwXJGCbN9oUSkBCLmjHtY/KVHav7MaPC2I6fcI+K 2Lkbja0SC2YVqjEqHW/7pGL/OIjyUOPAz0KYYBYmF2D/Bw1fDOwvmSYce+2Aqjc0gRUoCm8iLWp/ brS7NcoFiPIQHaDg4R5C9jbAt0H20yimK60zxR2oJ6CbAgIz3qDzbjpgYps6N1KJAjcYxw2mwqnt VhksrZW7X6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BQPUcQeji6ElWx5hhLMDd1L55i4otgyOInhvlaFITWqb2ZXq rCgarjer96jkveLG2oE6GBO4VoZmrfYuWJWyvFiPfbgqgrSeFrODZW4iRe1orOorKiYiAgynrSTF HHdL2gyEP8XckU4UJBr1YsoA --===============6710846979611996202==--