summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2022-04-12 13:39:04 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2022-04-21 15:23:21 +0300
commit188aae65e4fa43b73ee1af6ce26724c3dca61380 (patch)
treef638e47a41d5e15bd6d8f8abf488c9a9fcf46521 /storage
parentaec856073df12e95b68667587bfd8e469b60e7d4 (diff)
downloadmariadb-git-188aae65e4fa43b73ee1af6ce26724c3dca61380.tar.gz
MDEV-26224 InnoDB fails to remove AUTO_INCREMENT attribute
Reset dict_table_t::persistent_autoinc when inplace alter table is committed successfully.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/handler0alter.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index e79d9d67dbf..91a5fd3ca4a 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -10711,6 +10711,10 @@ commit_cache_norebuild(
: NULL;
DBUG_ASSERT((ctx->new_table->fts == NULL)
== (ctx->new_table->fts_doc_id_index == NULL));
+ if (table->found_next_number_field
+ && !altered_table->found_next_number_field) {
+ ctx->prebuilt->table->persistent_autoinc = 0;
+ }
DBUG_RETURN(found);
}
@@ -11035,7 +11039,15 @@ ha_innobase::commit_inplace_alter_table(
if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) {
DBUG_ASSERT(!ctx0);
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
- ha_alter_info->group_commit_ctx = NULL;
+ if (table->found_next_number_field
+ && !altered_table->found_next_number_field) {
+ m_prebuilt->table->persistent_autoinc = 0;
+ /* Don't reset ha_alter_info->group_commit_ctx to make
+ partitions engine to call this function for all
+ partitions. */
+ }
+ else
+ ha_alter_info->group_commit_ctx = NULL;
DBUG_RETURN(false);
}
@@ -11543,6 +11555,8 @@ foreign_fail:
row_mysql_unlock_data_dictionary(trx);
trx->free();
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
+ /* There is no need to reset dict_table_t::persistent_autoinc
+ as the table is reloaded */
DBUG_RETURN(false);
}