BUG#29152 - INSERT DELAYED does not use concurrent_insert on slave

INSERT DELAYED on a replication slave was converted to regular INSERT,
whereas it should try concurrent INSERT first.

With this patch we try to convert delayed insert to concurrent insert on
a replication slave. If it is impossible for some reason, we fall back to
regular insert.

No test case for this fix. I do not see anything indicating this is
regression - we behave this way since Nov 2000.
parent edc859ff
......@@ -446,7 +446,6 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
client connection and the delayed thread.
*/
if (specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE) ||
thd->slave_thread ||
thd->variables.max_insert_delayed_threads == 0 ||
thd->prelocked_mode ||
thd->lex->uses_stored_routines())
......@@ -454,6 +453,14 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
*lock_type= TL_WRITE;
return;
}
if (thd->slave_thread)
{
/* Try concurrent insert */
*lock_type= (duplic == DUP_UPDATE || duplic == DUP_REPLACE) ?
TL_WRITE : TL_WRITE_CONCURRENT_INSERT;
return;
}
bool log_on= (thd->options & OPTION_BIN_LOG ||
! (thd->security_ctx->master_access & SUPER_ACL));
if (log_on && mysql_bin_log.is_open() && is_multi_insert)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment