Skip to content

Commit dae05df

Browse files
committed
Bug#34463089 [InnoDB] Assertion failure:
btr0cur.cc:4024:page_zip || optim_err != DB_UNDERFLO Issue : When a column is being dropped from a table and in the same alter command if another existing column of table is being renamed to column being dropped, then physical positions of the columns are not set correctly. Fix: Physical position of column never changes even if it is being renamed or dropped. So set the column physical position correctly. Change-Id: I4bc387dd55330bcedfb4a26404a3d7dd9f58eb32
1 parent b8ce6b8 commit dae05df

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

storage/innobase/dict/dict0dd.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,9 +1664,9 @@ bool is_dropped(const Alter_inplace_info *ha_alter_info,
16641664

16651665
void dd_copy_table_columns(const Alter_inplace_info *ha_alter_info,
16661666
dd::Table &new_table, const dd::Table &old_table,
1667-
dict_table_t *dict_table) {
1667+
dict_table_t *old_dict_table) {
16681668
bool first_row_version = false;
1669-
if (dict_table && !dict_table->has_row_versions()) {
1669+
if (old_dict_table && !old_dict_table->has_row_versions()) {
16701670
first_row_version = true;
16711671
}
16721672

@@ -1684,13 +1684,11 @@ void dd_copy_table_columns(const Alter_inplace_info *ha_alter_info,
16841684

16851685
dd::Column *new_col = nullptr;
16861686
std::string new_name;
1687-
IF_DEBUG(bool renamed = false;)
16881687

16891688
/* Skip the dropped column */
16901689
if (is_dropped(ha_alter_info, old_col->name().c_str())) {
16911690
continue;
16921691
} else if (is_renamed(ha_alter_info, old_col->name().c_str(), new_name)) {
1693-
IF_DEBUG(renamed = true;)
16941692
new_col = const_cast<dd::Column *>(
16951693
dd_find_column(&new_table, new_name.c_str()));
16961694
} else {
@@ -1708,14 +1706,11 @@ void dd_copy_table_columns(const Alter_inplace_info *ha_alter_info,
17081706
}
17091707

17101708
/* If this is first time table is getting row version, add physical pos */
1711-
if (dict_table && !new_col->is_virtual() && first_row_version) {
1712-
dict_col_t *col = dict_table->get_col_by_name(new_col->name().c_str());
1713-
if (col == nullptr) {
1714-
ut_ad(renamed);
1715-
col = dict_table->get_col_by_name(old_col->name().c_str());
1716-
}
1717-
1718-
ut_ad(col != nullptr);
1709+
if (old_dict_table && !new_col->is_virtual() && first_row_version) {
1710+
/* Even the renamed column would have same phy_pos as old column */
1711+
dict_col_t *col =
1712+
old_dict_table->get_col_by_name(old_col->name().c_str());
1713+
ut_a(col != nullptr);
17191714
new_col->se_private_data().set(s, col->get_phy_pos());
17201715
}
17211716
}

0 commit comments

Comments
 (0)