3685 Jon Olav Hauglid 2009-11-18 [merge]
merge from 5.1-bugteam
modified:
mysql-test/r/delayed.result
mysql-test/t/delayed.test
sql/sql_insert.cc
3684 Kent Boortz 2009-11-17 [merge]
Merge
modified:
scripts/make_win_bin_dist
=== modified file 'mysql-test/r/delayed.result'
--- a/mysql-test/r/delayed.result 2009-11-02 15:16:58 +0000
+++ b/mysql-test/r/delayed.result 2009-11-18 09:25:53 +0000
@@ -310,6 +310,18 @@ a b
2 2
drop table t1;
set global low_priority_updates = @old_delayed_updates;
+#
+# Bug #47682 strange behaviour of INSERT DELAYED
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (f1 integer);
+CREATE TABLE t2 (f1 integer);
+FLUSH TABLES WITH READ LOCK;
+LOCK TABLES t1 READ;
+INSERT DELAYED INTO t2 VALUES (1);
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES;
+DROP TABLE t1, t2;
End of 5.1 tests
#
# Bug #47274 assert in open_table on CREATE TABLE <already existing>
=== modified file 'mysql-test/t/delayed.test'
--- a/mysql-test/t/delayed.test 2009-11-02 15:16:58 +0000
+++ b/mysql-test/t/delayed.test 2009-11-18 09:25:53 +0000
@@ -337,6 +337,28 @@ drop table t1;
set global low_priority_updates = @old_delayed_updates;
+
+--echo #
+--echo # Bug #47682 strange behaviour of INSERT DELAYED
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (f1 integer);
+CREATE TABLE t2 (f1 integer);
+
+FLUSH TABLES WITH READ LOCK;
+LOCK TABLES t1 READ;
+
+--error ER_CANT_UPDATE_WITH_READLOCK
+INSERT DELAYED INTO t2 VALUES (1);
+
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
+
--echo End of 5.1 tests
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-02 15:16:58 +0000
+++ b/sql/sql_insert.cc 2009-11-18 09:25:53 +0000
@@ -520,6 +520,22 @@ bool open_and_lock_for_insert_delayed(TH
DBUG_ENTER("open_and_lock_for_insert_delayed");
#ifndef EMBEDDED_LIBRARY
+ if (thd->locked_tables_mode && thd->global_read_lock)
+ {
+ /*
+ If this connection has the global read lock, the handler thread
+ will not be able to lock the table. It will wait for the global
+ read lock to go away, but this will never happen since the
+ connection thread will be stuck waiting for the handler thread
+ to open and lock the table.
+ If we are not in locked tables mode, INSERT will seek protection
+ against the global read lock (and fail), thus we will only get
+ to this point in locked tables mode.
+ */
+ my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
if (delayed_get_table(thd, table_list))
DBUG_RETURN(TRUE);
Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20091118092553-3df0oqqa5a8vohs0.bundle
| Thread |
|---|
| • bzr push into mysql-pe branch (jon.hauglid:3684 to 3685) | Jon Olav Hauglid | 18 Nov |