Commit d3145a91 authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

ha_innobase.cc:

  Backport from 4.0: convert TL_READ_NO_INSERT to TL_READ to allow concurrent inserts to the table in INSERT INTO ... SELECT ... FROM table
parent 3e6bfd72
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -3718,6 +3718,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;
  	}