From d5833961ced5efb64c62d17dd7e632eefefede3d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jan 2003 00:38:55 +0200 Subject: ha_innodb.cc: Convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table sql/ha_innodb.cc: Convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table --- sql/ha_innodb.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sql/ha_innodb.cc') 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; } -- cgit v1.2.1