diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 13:19:18 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 13:19:18 +0300 |
commit | 1619ae899099c4934f3b5919b2398c95a7cacc94 (patch) | |
tree | 1f97834427618091e91a99907c0d08a9fb19b19c | |
parent | 77c00799e501def2868399ec3f39ee1bee3f2384 (diff) | |
download | mariadb-git-1619ae899099c4934f3b5919b2398c95a7cacc94.tar.gz |
MDEV-23672: Partly revert an incorrect fix
In commit 7eda55619654b76add275695e0a6039e60876e81 we removed a
valid debug assertion.
AddressSanitizer would trip when writing undo log for an INSERT
operation that follows the problematic ALTER TABLE because the
v_indexes would refer to an index object that was freed during
the execution of ALTER TABLE.
The operation to remove NOT NULL attribute from a column should
lead into any affected indexes to be dropped and re-created.
But, the SQL layer set the ha_alter_info->handler_flags to
HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE|ALTER_COLUMN_NULLABLE
(that is, InnoDB was asked to add an index and change the column,
but not to drop the index that depended on the column).
Let us restore the debug assertion that catches this problem
outside AddressSanitizer, and 'defuse' the offending ALTER TABLE
statement in the test until something has been fixed in the SQL layer.
-rw-r--r-- | mysql-test/suite/innodb/r/instant_alter_bugs.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/instant_alter_bugs.test | 10 | ||||
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 1 |
3 files changed, 9 insertions, 8 deletions
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 45172be8593..473ee1926da 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -422,11 +422,9 @@ col_text text not null, col_int_g integer generated always as (col_int) unique, col_text_g text generated always as (substr(col_text,1,499)) ) engine innodb row_format = redundant; -insert into t1 values (0, 'a', default, default); -insert into t1 values (null, 'b', default, default); +insert into t1 (col_int,col_text) values (0, 'a'), (null, 'b'); alter table t1 modify column col_text text null, algorithm = instant; -insert into t1 values (1, null, default, default); -insert into t1 values (null, null, default, default); +insert into t1 (col_int,col_text) values (1, null), (null, null); update t1 set col_text= 'd'; select * from t1; col_int col_text col_int_g col_text_g diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 12beabf1be2..eb2198e2a96 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -445,11 +445,13 @@ create table t1 ( col_int_g integer generated always as (col_int) unique, col_text_g text generated always as (substr(col_text,1,499)) ) engine innodb row_format = redundant; -insert into t1 values (0, 'a', default, default); -insert into t1 values (null, 'b', default, default); +insert into t1 (col_int,col_text) values (0, 'a'), (null, 'b'); +# FIXME: remove the following to trigger the bug +--disable_query_log +alter table t1 modify column col_text text null, force; +--enable_query_log alter table t1 modify column col_text text null, algorithm = instant; -insert into t1 values (1, null, default, default); -insert into t1 values (null, null, default, default); +insert into t1 (col_int,col_text) values (1, null), (null, null); update t1 set col_text= 'd'; select * from t1; check table t1; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index b714dd63da6..b0108d32e58 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -605,6 +605,7 @@ inline bool dict_table_t::instant_column(const dict_table_t& table, for (unsigned i = 0; i < n_v_def; i++) { dict_v_col_t& v = v_cols[i]; + DBUG_ASSERT(v.v_indexes.empty()); v.base_col = static_cast<dict_col_t**>( mem_heap_dup(heap, v.base_col, v.num_base * sizeof *v.base_col)); |