Commit 3f78fbc5 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-25180 fixup: Assertion table->def_trx_id == trx->id... failed in row_merge_drop_indexes()

We must invoke online_retry_drop_indexes() before
ha_innobase_inplace_ctx::trx->id is assigned.
parent 6a4e5bf1
...@@ -8073,6 +8073,12 @@ ha_innobase::prepare_inplace_alter_table( ...@@ -8073,6 +8073,12 @@ ha_innobase::prepare_inplace_alter_table(
== ALTER_OPTIONS == ALTER_OPTIONS
&& !alter_options_need_rebuild(ha_alter_info, table))) { && !alter_options_need_rebuild(ha_alter_info, table))) {
DBUG_ASSERT(!m_prebuilt->trx->dict_operation_lock_mode);
if (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) {
online_retry_drop_indexes(m_prebuilt->table,
m_user_thd);
}
if (heap) { if (heap) {
ha_alter_info->handler_ctx ha_alter_info->handler_ctx
= new ha_innobase_inplace_ctx( = new ha_innobase_inplace_ctx(
...@@ -8089,14 +8095,6 @@ ha_innobase::prepare_inplace_alter_table( ...@@ -8089,14 +8095,6 @@ ha_innobase::prepare_inplace_alter_table(
alt_opt.page_compression_level); alt_opt.page_compression_level);
} }
DBUG_ASSERT(m_prebuilt->trx->dict_operation_lock_mode == 0);
if (ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE)) {
online_retry_drop_indexes(
m_prebuilt->table, m_user_thd);
}
if ((ha_alter_info->handler_flags if ((ha_alter_info->handler_flags
& ALTER_DROP_VIRTUAL_COLUMN) & ALTER_DROP_VIRTUAL_COLUMN)
&& prepare_inplace_drop_virtual(ha_alter_info, table)) { && prepare_inplace_drop_virtual(ha_alter_info, table)) {
...@@ -11119,7 +11117,22 @@ ha_innobase::commit_inplace_alter_table( ...@@ -11119,7 +11117,22 @@ ha_innobase::commit_inplace_alter_table(
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_ad(!new_clustered || trx->has_logged()); ut_ad(!new_clustered || trx->has_logged());
/* The SQL layer recovery of ALTER TABLE will invoke
innodb_check_version() to know whether our trx->id, which we
reported via ha_innobase::table_version() after
ha_innobase::prepare_inplace_alter_table(), was committed.
If this trx was committed (the log write below completed),
we will be able to recover our trx->id to
dict_table_t::def_trx_id from the data dictionary tables.
For this logic to work, purge_sys.stop_SYS() and
purge_sys.resume_SYS() will ensure that the DB_TRX_ID that we
wrote to the SYS_ tables will be preserved until the SQL layer
has durably marked the ALTER TABLE operation as completed.
During recovery, the purge of InnoDB transaction history will
not start until innodb_ddl_recovery_done(). */
ha_alter_info->inplace_alter_table_committed = ha_alter_info->inplace_alter_table_committed =
purge_sys.resume_SYS; purge_sys.resume_SYS;
purge_sys.stop_SYS(); purge_sys.stop_SYS();
......
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