summaryrefslogtreecommitdiffstats
path: root/storage/innobase/handler/handler0alter.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
commit86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch)
tree28c9e526ea739c6f9b89e36115e1e2698bddf981 /storage/innobase/handler/handler0alter.cc
parentReleasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff)
downloadmariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz
mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/innobase/handler/handler0alter.cc')
-rw-r--r--storage/innobase/handler/handler0alter.cc40
1 files changed, 21 insertions, 19 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 40370ac5..1401136f 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -2317,12 +2317,16 @@ innodb_instant_alter_column_allowed_reason:
}
}
+ bool need_rebuild = false;
+
switch (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) {
case ALTER_OPTIONS:
- if (alter_options_need_rebuild(ha_alter_info, table)) {
+ if ((srv_file_per_table && !m_prebuilt->table->space_id)
+ || alter_options_need_rebuild(ha_alter_info, table)) {
reason_rebuild = my_get_err_msg(
ER_ALTER_OPERATION_TABLE_OPTIONS_NEED_REBUILD);
ha_alter_info->unsupported_reason = reason_rebuild;
+ need_rebuild= true;
break;
}
/* fall through */
@@ -2434,7 +2438,7 @@ innodb_instant_alter_column_allowed_reason:
/* We should be able to do the operation in-place.
See if we can do it online (LOCK=NONE) or without rebuild. */
- bool online = true, need_rebuild = false;
+ bool online = true;
const uint fulltext_indexes = innobase_fulltext_exist(altered_table);
/* Fix the key parts. */
@@ -4338,7 +4342,8 @@ static void unlock_and_close_files(const std::vector<pfs_os_file_t> &deleted,
row_mysql_unlock_data_dictionary(trx);
for (pfs_os_file_t d : deleted)
os_file_close(d);
- log_write_up_to(trx->commit_lsn, true);
+ if (trx->commit_lsn)
+ log_write_up_to(trx->commit_lsn, true);
}
/** Commit a DDL transaction and unlink any deleted files. */
@@ -4681,11 +4686,13 @@ innobase_build_col_map(
col_map[old_i - num_old_v] = i;
if (!old_table->versioned()
|| !altered_table->versioned()) {
- } else if (old_i == old_table->vers_start) {
- new_table->vers_start = (i + num_v)
+ } else if (old_i - num_old_v == old_table->vers_start) {
+ ut_ad(field->vers_sys_start());
+ new_table->vers_start = i
& dict_index_t::MAX_N_FIELDS;
- } else if (old_i == old_table->vers_end) {
- new_table->vers_end = (i + num_v)
+ } else if (old_i - num_old_v == old_table->vers_end) {
+ ut_ad(field->vers_sys_end());
+ new_table->vers_end = i
& dict_index_t::MAX_N_FIELDS;
}
goto found_col;
@@ -6217,24 +6224,20 @@ empty_table:
/* Convert the table to the instant ALTER TABLE format. */
mtr.commit();
mtr.start();
- index->set_modified(mtr);
- if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr,
+ if (buf_block_t* root = btr_root_block_get(index, RW_S_LATCH, &mtr,
&err)) {
if (fil_page_get_type(root->page.frame) != FIL_PAGE_INDEX) {
DBUG_ASSERT("wrong page type" == 0);
err = DB_CORRUPTION;
goto func_exit;
}
-
- btr_set_instant(root, *index, &mtr);
- mtr.commit();
- mtr.start();
- index->set_modified(mtr);
- err = row_ins_clust_index_entry_low(
- BTR_NO_LOCKING_FLAG, BTR_MODIFY_TREE, index,
- index->n_uniq, entry, 0, thr);
}
+ mtr.commit();
+ mtr.start();
+ err = row_ins_clust_index_entry_low(
+ BTR_NO_LOCKING_FLAG, BTR_MODIFY_TREE, index,
+ index->n_uniq, entry, 0, thr);
goto func_exit;
}
@@ -7775,6 +7778,7 @@ bool check_col_is_in_fk_indexes(
for (const auto &a : add_fk)
{
+ if (!a->foreign_index) continue;
for (ulint i= 0; i < a->n_fields; i++)
{
if (a->foreign_index->fields[i].col == col)
@@ -11666,7 +11670,6 @@ foreign_fail:
}
unlock_and_close_files(deleted, trx);
- log_write_up_to(trx->commit_lsn, true);
DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit",
DBUG_SUICIDE(););
trx->free();
@@ -11723,7 +11726,6 @@ foreign_fail:
}
unlock_and_close_files(deleted, trx);
- log_write_up_to(trx->commit_lsn, true);
DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit",
DBUG_SUICIDE(););
trx->free();