Commit 9e14a2df authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-24072 Assertion 'ib_table.n_v_cols' failed in instant_alter_column_possible()

instant_alter_column_possible(): Relax a too strict debug assertion.
The existence of an index stub or a corrupted index on virtual columns
does not imply that virtual columns exist.
parent 5b779c22
......@@ -436,4 +436,16 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
#
# MDEV-24072 Assertion 'ib_table.n_v_cols' failed
# in instant_alter_column_possible()
#
CREATE TABLE t (a BLOB) ENGINE=InnoDB;
INSERT INTO t VALUES ('a');
ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a+1) VIRTUAL, ADD KEY(c);
ERROR 22007: Truncated incorrect DOUBLE value: 'a'
ALTER TABLE t ADD d INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
......@@ -453,4 +453,17 @@ select * from t1;
check table t1;
drop table t1;
--echo #
--echo # MDEV-24072 Assertion 'ib_table.n_v_cols' failed
--echo # in instant_alter_column_possible()
--echo #
CREATE TABLE t (a BLOB) ENGINE=InnoDB;
INSERT INTO t VALUES ('a');
--error ER_TRUNCATED_WRONG_VALUE
ALTER TABLE t ADD c INT GENERATED ALWAYS AS (a+1) VIRTUAL, ADD KEY(c);
--enable_info
ALTER TABLE t ADD d INT;
--disable_info
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
......@@ -1505,7 +1505,8 @@ instant_alter_column_possible(
for (const dict_index_t* index = ib_table.indexes.start;
index; index = index->indexes.next) {
if (index->has_virtual()) {
ut_ad(ib_table.n_v_cols);
ut_ad(ib_table.n_v_cols
|| index->is_corrupted());
return false;
}
}
......
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