diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2018-12-03 19:56:55 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-28 16:26:18 +0200 |
commit | d46b3c99b48522477c5c6017ad1bcf223903e59e (patch) | |
tree | 89fde1e67f247a9a4243c9d7ee2488f07d07e9ef /storage | |
parent | cb2f36d3ea27835a6e52a096b4eefd86f5f4383a (diff) | |
download | mariadb-git-d46b3c99b48522477c5c6017ad1bcf223903e59e.tar.gz |
MDEV-17697 Broken versioning info after instant drop column
Closes #986
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 27 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 3 |
2 files changed, 28 insertions, 2 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 5847acb30e1..ba17febeda9 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -538,6 +538,14 @@ inline bool dict_table_t::instant_column(const dict_table_t& table, & ~(DATA_NOT_NULL | DATA_VERSIONED))); DBUG_ASSERT(c.mtype == o->mtype); DBUG_ASSERT(c.len >= o->len); + + if (o->vers_sys_start()) { + ut_ad(o->ind == vers_start); + vers_start = i; + } else if (o->vers_sys_end()) { + ut_ad(o->ind == vers_end); + vers_end = i; + } continue; } @@ -786,6 +794,16 @@ inline void dict_table_t::rollback_instant( n_v_def = n_v_cols = old_n_v_cols; n_t_def = n_t_cols = n_cols + n_v_cols; + if (versioned()) { + for (unsigned i = 0; i < n_cols; ++i) { + if (cols[i].vers_sys_start()) { + vers_start = i; + } else if (cols[i].vers_sys_end()) { + vers_end = i; + } + } + } + index->fields = old_fields; mtr.commit(); @@ -4116,7 +4134,7 @@ innobase_build_col_map( Alter_inplace_info* ha_alter_info, const TABLE* altered_table, const TABLE* table, - const dict_table_t* new_table, + dict_table_t* new_table, const dict_table_t* old_table, dtuple_t* defaults, mem_heap_t* heap) @@ -4190,6 +4208,13 @@ innobase_build_col_map( } col_map[old_i - num_old_v] = i; + if (old_table->versioned()) { + if (old_i == old_table->vers_start) { + new_table->vers_start = i; + } else if (old_i == old_table->vers_end) { + new_table->vers_end = i; + } + } goto found_col; } } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 58c960bc06e..52b5361f71f 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -618,7 +618,8 @@ public: ut_ad(mtype == DATA_INT || mtype == DATA_FIXBINARY); return mtype == DATA_INT; } - /** @return whether this is system versioned */ + /** @return whether this user column (not row_start, row_end) + has System Versioning property */ bool is_versioned() const { return !(~prtype & DATA_VERSIONED); } /** @return whether this is the system version start */ bool vers_sys_start() const |