Skip to content
/ server Public

MDEV-38928 Assertion undo_no <= 1 in reset_and_truncate_undo during ALTER IGNORE on temporary table#4717

Open
Thirunarayanan wants to merge 1 commit into10.11from
MDEV-38928
Open

MDEV-38928 Assertion undo_no <= 1 in reset_and_truncate_undo during ALTER IGNORE on temporary table#4717
Thirunarayanan wants to merge 1 commit into10.11from
MDEV-38928

Conversation

@Thirunarayanan
Copy link
Member

Problem:

An assertion failure occurs during an ALTER IGNORE operation on
an InnoDB temporary table. The failure happens in
trx_t::reset_and_truncate_undo() because the InnoDB DDL attempts to manually clear and truncate undo logs after the data-fill phase. This optimization is intended only for non-temporary tables. InnoDB maintains the last undo log record during row insertion and clears it upon commitment. However, temporary table undo logs are not processed by the purge thread. Attempting to apply this non-temporary optimization to a temporary table results in an assertion.

Solution:

Modify the DDL commit logic to explicitly skip the call to reset_and_truncate_undo() when the target is a temporary table.

…LTER IGNORE on temporary table

Problem:
=======
 An assertion failure occurs during an ALTER IGNORE operation on
an InnoDB temporary table. The failure happens in
trx_t::reset_and_truncate_undo() because the InnoDB DDL attempts
to manually clear and truncate undo logs after the data-fill phase.
This optimization is intended only for non-temporary tables.
InnoDB maintains the last undo log record during row insertion and
clears it upon commitment. However, temporary table undo logs
are not processed by the purge thread. Attempting to apply this
non-temporary optimization to a temporary table results in an
assertion.

Solution:
=========
Modify the DDL commit logic to explicitly skip the call to
reset_and_truncate_undo() when the target is a temporary table.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@dr-m dr-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a nice simple test case posted at the start of MDEV-38928. Please include it in the regression test suite.

Comment on lines -15925 to 15927
if (m_prebuilt->table->skip_alter_undo ==
if (!m_prebuilt->table->is_temporary() &&
m_prebuilt->table->skip_alter_undo ==
dict_table_t::IGNORE_UNDO) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, I think that it would be better to check the less likely condition first. ALTER IGNORE TABLE should be less likely to be invoked than any operation on temporary tables.

I also notice that m_prebuilt->table->skip_alter_undo is a bit-field. Because we are reading it multiple times in this code path, it would make sense to assign the value to a local variable during the first access.

I forgot to point out in #4636 that the locking rules of the bit-fields that are shared with skip_alter_undo will need to be documented. It seems to me that all fields should be protected by MDL_EXCLUSIVE on the table name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants