List:Commits« Previous MessageNext Message »
From:<gshchepa Date:October 8 2007 11:38am
Subject:bk commit into 5.1 tree (gshchepa:1.2580) BUG#31310
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of uchum. When uchum does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-08 16:37:58+05:00, gshchepa@stripped +3 -0
  Fixed bug #31310.
  Locked rows of the InnoDB storage was silently skipped in the read-committed
  isolation level.
  
  QUICK_RANGE_SELECT lacks second (blocking) read of record that was read
  semi-consistently and just skip it.
  
  The handler::read_multi_range_next method has been modified
  to retry reading of the previous record after the semi-consistent
  read.

  mysql-test/include/mix1.inc@stripped, 2007-10-08 16:35:25+05:00, gshchepa@stripped +33 -0
    Added test case for bug #31310.

  mysql-test/r/innodb_mysql.result@stripped, 2007-10-08 16:35:27+05:00, gshchepa@stripped +21 -0
    Added test case for bug #31310.

  sql/handler.cc@stripped, 2007-10-08 16:35:21+05:00, gshchepa@stripped +12 -0
    Fixed bug #31310.
    The handler::read_multi_range_next method has been modified
    to retry reading of the previous record after the semi-consistent
    read.

diff -Nrup a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
--- a/mysql-test/include/mix1.inc	2007-09-14 21:03:12 +05:00
+++ b/mysql-test/include/mix1.inc	2007-10-08 16:35:25 +05:00
@@ -1146,4 +1146,37 @@ select @b:=f2 from t1;
 select if(@a=@b,"ok","wrong");
 drop table t1;
 
+#
+# Bug #31310: Locked rows silently skipped in read-committed isolation level.
+#
+
+eval
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT)
+ENGINE = $engine_type;
+INSERT INTO t1 VALUES (1,2);
+BEGIN;
+--enable_info
+UPDATE t1 SET b = 12 WHERE a = 1;
+--disable_info
+SELECT * FROM t1;
+
+--echo # establish connection con2 (user=root)
+connect (con2,localhost,root,,);
+SET SESSION AUTOCOMMIT = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+--enable_info
+--disable_abort_on_error
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET b = 21 WHERE a = 1;
+--disable_info
+
+# Cleanup
+--echo # Switch to connection default and close connection con2
+connection default;
+disconnect con2;
+SELECT * FROM t1;
+ROLLBACK;
+DROP TABLE t1;
+
 --echo End of 5.1 tests
diff -Nrup a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
--- a/mysql-test/r/innodb_mysql.result	2007-09-14 21:03:12 +05:00
+++ b/mysql-test/r/innodb_mysql.result	2007-10-08 16:35:27 +05:00
@@ -1419,4 +1419,25 @@ select if(@a=@b,"ok","wrong");
 if(@a=@b,"ok","wrong")
 ok
 drop table t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT)
+ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,2);
+BEGIN;
+UPDATE t1 SET b = 12 WHERE a = 1;
+affected rows: 1
+info: Rows matched: 1  Changed: 1  Warnings: 0
+SELECT * FROM t1;
+a	b
+1	12
+# establish connection con2 (user=root)
+SET SESSION AUTOCOMMIT = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+UPDATE t1 SET b = 21 WHERE a = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Switch to connection default and close connection con2
+SELECT * FROM t1;
+a	b
+1	12
+ROLLBACK;
+DROP TABLE t1;
 End of 5.1 tests
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc	2007-08-31 11:57:57 +05:00
+++ b/sql/handler.cc	2007-10-08 16:35:21 +05:00
@@ -3134,6 +3134,18 @@ int handler::read_multi_range_next(KEY_M
 
   do
   {
+    if (was_semi_consistent_read())
+    {
+      /* Try to re-read the previous record after the semi-consistent read. */
+      result= index_next_same(table->record[0],
+                              end_range->key,
+                              end_range->length);
+
+      /* On success or non-EOF errors jump to the end. */
+      if (result != HA_ERR_END_OF_FILE)
+        break;
+    }
+
     /* Save a call if there can be only one row in range. */
     if (multi_range_curr->range_flag != (UNIQUE_RANGE | EQ_RANGE))
     {
Thread
bk commit into 5.1 tree (gshchepa:1.2580) BUG#31310gshchepa8 Oct