summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2003-01-21 00:38:55 +0200
committerheikki@hundin.mysql.fi <>2003-01-21 00:38:55 +0200
commitff4ef4c4e7d51421cfde0016148eda935f65cd4e (patch)
treecd5a9dfca16e50b21a32d16a61e1fcded10f5cc8
parentfab7f39e4207f0da10603be3e7ea2d92b6f622ac (diff)
downloadmariadb-git-ff4ef4c4e7d51421cfde0016148eda935f65cd4e.tar.gz
ha_innodb.cc:
Convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table
-rw-r--r--sql/ha_innodb.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b4fe6130e9b..b1cb45be6b3 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -4166,6 +4166,16 @@ ha_innobase::store_lock(
lock_type = TL_WRITE_ALLOW_WRITE;
}
+ /* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
+ MySQL would use the lock TL_READ_NO_INSERT on t2, and that
+ would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
+ to t2. Convert the lock to a normal read lock to allow
+ concurrent inserts to t2. */
+
+ if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) {
+ lock_type = TL_READ;
+ }
+
lock.type=lock_type;
}