summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_mysql.test
diff options
context:
space:
mode:
authorunknown <mhansson/martin@linux-st28.site>2007-08-15 09:23:44 +0200
committerunknown <mhansson/martin@linux-st28.site>2007-08-15 09:23:44 +0200
commit01f8130aa68392d14f36cc17c01e1b349bf844f5 (patch)
tree2d9eb6b63a9f0e51771e9422008f51c07409e227 /mysql-test/t/innodb_mysql.test
parent1f83b351818fca51a14bc34a224c4a80e14c9476 (diff)
downloadmariadb-git-01f8130aa68392d14f36cc17c01e1b349bf844f5.tar.gz
bug#28570: handler::index_read() is called with different find_flag when
ORDER BY is used The range analysis module did not correctly signal to the handler that a range represents a ref (EQ_RANGE flag). This causes non-range queries like SELECT ... FROM ... WHERE keypart_1=const, ..., keypart_n=const ORDER BY ... FOR UPDATE to wait for a lock unneccesarily if another running transaction uses SELECT ... FOR UPDATE on the same table. Fixed by setting EQ_RANGE for all range accesses that represent an equality predicate. mysql-test/r/innodb_mysql.result: bug#28570: Test Result mysql-test/t/innodb_mysql.test: bug#28570: Test Case sql/handler.cc: bug#28570: Updated comment sql/opt_range.cc: bug#28570: Removed the criterion that key has to be unique (HA_NOSAME) in order for the EQ_RANGE flag to be set. It is sufficient that the range represent a ref access.
Diffstat (limited to 'mysql-test/t/innodb_mysql.test')
-rw-r--r--mysql-test/t/innodb_mysql.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 63431e10bbf..e27db9944fe 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -840,5 +840,34 @@ DISCONNECT con2;
DROP PROCEDURE p1;
DROP TABLE t1;
+#
+# Bug #28570: handler::index_read() is called with different find_flag when
+# ORDER BY is used
+#
+
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=20 FOR UPDATE;
+
+--connect (conn2, localhost, root,,test)
+
+# This statement gives a "failed: 1205: Lock wait timeout exceeded; try
+# restarting transaction" message when the bug is present.
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
+ROLLBACK;
+
+--disconnect conn2
+--connection default
+
+ROLLBACK;
+DROP TABLE t1;
--echo End of 5.0 tests