MDEV-35813 Unnecessary InnoDB log writes in INSERT…SELECT
ha_innobase::extra(): Conditionally avoid a log write that had been added in commit e5b9dc15368c7597a70569048eebfc5e05e98ef4 (MDEV-25910) because it may be invoked as part of select_insert::prepare_eof() and not only during DDL operations. Reviewed by: Sergei Golubchik
This commit is contained in:
parent
04e114aec0
commit
c3c5cd9377
@ -11135,7 +11135,7 @@ do_continue:;
|
|||||||
|
|
||||||
debug_crash_here("ddl_log_alter_after_copy"); // Use old table
|
debug_crash_here("ddl_log_alter_after_copy"); // Use old table
|
||||||
/*
|
/*
|
||||||
We are new ready to use the new table. Update the state in the
|
We are now ready to use the new table. Update the state in the
|
||||||
ddl log so that we recovery know that the new table is ready and
|
ddl log so that we recovery know that the new table is ready and
|
||||||
in case of crash it should use the new one and log the query
|
in case of crash it should use the new one and log the query
|
||||||
to the binary log.
|
to the binary log.
|
||||||
|
@ -15958,9 +15958,22 @@ ha_innobase::extra(
|
|||||||
break;
|
break;
|
||||||
case HA_EXTRA_END_ALTER_COPY:
|
case HA_EXTRA_END_ALTER_COPY:
|
||||||
trx = check_trx_exists(ha_thd());
|
trx = check_trx_exists(ha_thd());
|
||||||
|
if (!m_prebuilt->table->skip_alter_undo) {
|
||||||
|
/* This could be invoked inside INSERT...SELECT.
|
||||||
|
We do not want any extra log writes, because
|
||||||
|
they could cause a severe performance regression. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_prebuilt->table->skip_alter_undo = 0;
|
m_prebuilt->table->skip_alter_undo = 0;
|
||||||
if (!m_prebuilt->table->is_temporary()
|
if (!m_prebuilt->table->is_temporary()
|
||||||
&& !high_level_read_only) {
|
&& !high_level_read_only) {
|
||||||
|
/* The extra log write is necessary for
|
||||||
|
ALTER TABLE...ALGORITHM=COPY, because
|
||||||
|
a normal transaction commit would be a no-op
|
||||||
|
because no undo log records were generated.
|
||||||
|
This log write will also be unnecessarily executed
|
||||||
|
during CREATE...SELECT, which is the other caller of
|
||||||
|
handler::extra(HA_EXTRA_BEGIN_ALTER_COPY). */
|
||||||
log_buffer_flush_to_disk();
|
log_buffer_flush_to_disk();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user