Commit 7bccd291 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-20479 assertion failure in dict_table_get_nth_col() after INSTANT DROP COLUMN

get_col_list_to_be_dropped() incorrectly returned uninteresting instantly
dropped column which was missing in a new dict_index_t

get_col_list_to_be_dropped(): rename to collect_columns_from_dropped_indexes
and stop return dropped columns
parent 4f10d091
...@@ -261,3 +261,11 @@ a ...@@ -261,3 +261,11 @@ a
1 1
3 3
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-20479: assertion failure in dict_table_get_nth_col() after INSTANT DROP COLUMN
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN (b INT, c INT, d INT, e INT NOT NULL DEFAULT 0);
ALTER TABLE t1 ADD UNIQUE INDEX(e);
ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e;
DROP TABLE t1;
...@@ -266,3 +266,14 @@ ROLLBACK; ...@@ -266,3 +266,14 @@ ROLLBACK;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-20479: assertion failure in dict_table_get_nth_col() after INSTANT DROP COLUMN
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN (b INT, c INT, d INT, e INT NOT NULL DEFAULT 0);
ALTER TABLE t1 ADD UNIQUE INDEX(e);
ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e;
DROP TABLE t1;
...@@ -9935,8 +9935,7 @@ commit_cache_rebuild( ...@@ -9935,8 +9935,7 @@ commit_cache_rebuild(
/** Set of column numbers */ /** Set of column numbers */
typedef std::set<ulint, std::less<ulint>, ut_allocator<ulint> > col_set; typedef std::set<ulint, std::less<ulint>, ut_allocator<ulint> > col_set;
/** Store the column number of the columns in a list belonging /** Collect (not instantly dropped) columns from dropped indexes
to indexes which are not being dropped.
@param[in] ctx In-place ALTER TABLE context @param[in] ctx In-place ALTER TABLE context
@param[in, out] drop_col_list list which will be set, containing columns @param[in, out] drop_col_list list which will be set, containing columns
which is part of index being dropped which is part of index being dropped
...@@ -9945,7 +9944,7 @@ to indexes which are not being dropped. ...@@ -9945,7 +9944,7 @@ to indexes which are not being dropped.
being dropped */ being dropped */
static static
void void
get_col_list_to_be_dropped( collect_columns_from_dropped_indexes(
const ha_innobase_inplace_ctx* ctx, const ha_innobase_inplace_ctx* ctx,
col_set& drop_col_list, col_set& drop_col_list,
col_set& drop_v_col_list) col_set& drop_v_col_list)
...@@ -9966,6 +9965,12 @@ get_col_list_to_be_dropped( ...@@ -9966,6 +9965,12 @@ get_col_list_to_be_dropped(
} else { } else {
ulint col_no = dict_col_get_no(idx_col); ulint col_no = dict_col_get_no(idx_col);
if (ctx->col_map
&& ctx->col_map[col_no]
== ULINT_UNDEFINED) {
// this column was instantly dropped
continue;
}
drop_col_list.insert(col_no); drop_col_list.insert(col_no);
} }
} }
...@@ -10287,7 +10292,7 @@ commit_cache_norebuild( ...@@ -10287,7 +10292,7 @@ commit_cache_norebuild(
/* Check if the column, part of an index to be dropped is part of any /* Check if the column, part of an index to be dropped is part of any
other index which is not being dropped. If it so, then set the ord_part other index which is not being dropped. If it so, then set the ord_part
of the column to 0. */ of the column to 0. */
get_col_list_to_be_dropped(ctx, drop_list, v_drop_list); collect_columns_from_dropped_indexes(ctx, drop_list, v_drop_list);
for (col_it = drop_list.begin(); col_it != drop_list.end(); ++col_it) { for (col_it = drop_list.begin(); col_it != drop_list.end(); ++col_it) {
if (!check_col_exists_in_indexes(ctx->new_table, if (!check_col_exists_in_indexes(ctx->new_table,
......
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