Skip to content

Commit

Permalink
MDEV-24072 Assertion 'ib_table.n_v_cols' failed in instant_alter_colu…
Browse files Browse the repository at this point in the history
…mn_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.
  • Loading branch information
dr-m committed Nov 2, 2020
1 parent 5b779c2 commit 9e14a2d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mysql-test/suite/innodb/r/instant_alter_bugs.result
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb/t/instant_alter_bugs.test
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion storage/innobase/handler/handler0alter.cc
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 9e14a2d

Please sign in to comment.