#At file:///home2/mydev/bzrroot/mysql-5.6-wl3561-3/ based on revid:ingo.struewing@stripped
2941 Ingo Struewing 2009-12-18
WL#3561 - transactional LOCK TABLE
Backport.
Backported revision revid:magne.mahre@stripped
Bug #46664 NOWAIT in SHARE mode causes immediate timeout although the
table is not locked
InnoDB does not currently support transactional locking with NOWAIT.
See Bug #24500 for reference to the InnoDB feature request.
The handler was changed so a more intelligible error code is returned,
and a couple of test cases was changed to reflect this.
This leaves the tree with failing *locktrans* test cases.
They will be fixed with a post-backport fix.
modified:
mysql-test/include/locktrans.inc
mysql-test/r/locktrans_innodb.result
mysql-test/r/rpl_locktrans_innodb.result
storage/innobase/handler/ha_innodb.h
=== modified file 'mysql-test/include/locktrans.inc'
--- a/mysql-test/include/locktrans.inc 2007-02-13 17:39:23 +0000
+++ b/mysql-test/include/locktrans.inc 2009-12-18 18:32:13 +0000
@@ -38,14 +38,14 @@ if ($nowait_support)
{
--echo #
--echo # Valid syntax for transactional locks with NOWAIT option.
---echo ## In the preliminary reference implementation we expect these errors:
---echo ## NOWAIT+SHARE="timed out", NOWAIT+EXCLUSIVE="not supported".
+--echo ## In the preliminary reference implementation we expect
+--echo ## "not supported" error.
--echo ## Statements abort on first error.
---error ER_LOCK_WAIT_TIMEOUT
+--error ER_UNSUPPORTED_EXTENSION
LOCK TABLE t1 IN SHARE MODE NOWAIT, t2 IN EXCLUSIVE MODE NOWAIT;
--error ER_UNSUPPORTED_EXTENSION
LOCK TABLE t1 IN EXCLUSIVE MODE NOWAIT, t2 IN SHARE MODE NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
+--error ER_UNSUPPORTED_EXTENSION
LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE NOWAIT;
}
#
@@ -702,7 +702,7 @@ LOCK TABLE t1 IN EXCLUSIVE MODE;
connection conn1;
--echo # Try an exclusive lock,
--echo # which conflicts and cannot immediately be taken.
- --error ER_LOCK_WAIT_TIMEOUT
+ --error ER_UNSUPPORTED_EXTENSION
LOCK TABLE t1 IN SHARE MODE NOWAIT;
--echo # connection default.
connection default;
=== modified file 'mysql-test/r/locktrans_innodb.result'
--- a/mysql-test/r/locktrans_innodb.result 2007-02-13 17:39:23 +0000
+++ b/mysql-test/r/locktrans_innodb.result 2009-12-18 18:32:13 +0000
@@ -23,15 +23,15 @@ LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLU
UNLOCK TABLES;
#
# Valid syntax for transactional locks with NOWAIT option.
-## In the preliminary reference implementation we expect these errors:
-## NOWAIT+SHARE="timed out", NOWAIT+EXCLUSIVE="not supported".
+## In the preliminary reference implementation we expect
+## "not supported" error.
## Statements abort on first error.
LOCK TABLE t1 IN SHARE MODE NOWAIT, t2 IN EXCLUSIVE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
LOCK TABLE t1 IN EXCLUSIVE MODE NOWAIT, t2 IN SHARE MODE NOWAIT;
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't2' uses an extension that doesn't exist in this MySQL version
#
# Valid syntax for aliases with and without 'AS'.
LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
@@ -615,7 +615,7 @@ LOCK TABLE t1 IN EXCLUSIVE MODE;
# Try an exclusive lock,
# which conflicts and cannot immediately be taken.
LOCK TABLE t1 IN SHARE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
# connection default.
# Commit.
COMMIT;
=== modified file 'mysql-test/r/rpl_locktrans_innodb.result'
--- a/mysql-test/r/rpl_locktrans_innodb.result 2007-02-13 17:39:23 +0000
+++ b/mysql-test/r/rpl_locktrans_innodb.result 2009-12-18 18:32:13 +0000
@@ -29,15 +29,15 @@ LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLU
UNLOCK TABLES;
#
# Valid syntax for transactional locks with NOWAIT option.
-## In the preliminary reference implementation we expect these errors:
-## NOWAIT+SHARE="timed out", NOWAIT+EXCLUSIVE="not supported".
+## In the preliminary reference implementation we expect
+## "not supported" error.
## Statements abort on first error.
LOCK TABLE t1 IN SHARE MODE NOWAIT, t2 IN EXCLUSIVE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
LOCK TABLE t1 IN EXCLUSIVE MODE NOWAIT, t2 IN SHARE MODE NOWAIT;
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't2' uses an extension that doesn't exist in this MySQL version
#
# Valid syntax for aliases with and without 'AS'.
LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
@@ -621,7 +621,7 @@ LOCK TABLE t1 IN EXCLUSIVE MODE;
# Try an exclusive lock,
# which conflicts and cannot immediately be taken.
LOCK TABLE t1 IN SHARE MODE NOWAIT;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
# connection default.
# Commit.
COMMIT;
=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h 2009-12-18 13:32:13 +0000
+++ b/storage/innobase/handler/ha_innodb.h 2009-12-18 18:32:13 +0000
@@ -155,17 +155,16 @@ class ha_innobase: public handler
int lock_table(THD *thd, int lock_type, int lock_timeout)
{
/*
- Preliminarily call the pre-existing internal method for
- transactional locking and ignore non-transactional locks.
+ Transactional locks in NOWAIT mode is not
+ currently supported by InnoDB
*/
if (!lock_timeout)
- {
- /* Preliminarily show both possible errors for NOWAIT. */
- if (lock_type == F_WRLCK)
return HA_ERR_UNSUPPORTED;
- else
- return HA_ERR_LOCK_WAIT_TIMEOUT;
- }
+
+ /*
+ Preliminarily call the pre-existing internal method for
+ transactional locking and ignore non-transactional locks.
+ */
return transactional_table_lock(thd, lock_type);
}
int external_lock(THD *thd, int lock_type);
Attachment: [text/bzr-bundle] bzr/ingo.struewing@sun.com-20091218183213-c35lr37kiqfjsu1s.bundle
Thread |
---|
• bzr commit into mysql-5.5-next-mr branch (ingo.struewing:2941)Bug#46664 WL#3561 | Ingo Struewing | 18 Dec |