diff options
Diffstat (limited to 'storage/innobase/include/dict0mem.h')
-rw-r--r-- | storage/innobase/include/dict0mem.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 6c116b9a428..154a503f1b3 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -588,6 +588,10 @@ struct dict_col_t{ 3072 (REC_VERSION_56_MAX_INDEX_COL_LEN) bytes. */ + /** Detach the column from an index. + @param[in] index index to be detached from */ + inline void detach(const dict_index_t& index); + /** Data for instantly added columns */ struct { /** original default value of instantly added column */ @@ -1045,9 +1049,24 @@ struct dict_index_t{ return DICT_CLUSTERED == (type & (DICT_CLUSTERED | DICT_IBUF)); } + /** @return whether the index includes virtual columns */ + bool has_virtual() const { return type & DICT_VIRTUAL; } + /** @return whether the index is corrupted */ inline bool is_corrupted() const; + /** Detach the columns from the index that is to be freed. */ + void detach_columns() + { + if (has_virtual()) { + for (unsigned i = 0; i < n_fields; i++) { + fields[i].col->detach(*this); + } + + n_fields = 0; + } + } + /** Determine how many fields of a given prefix can be set NULL. @param[in] n_prefix number of fields in the prefix @return number of fields 0..n_prefix-1 that can be set NULL */ @@ -1112,6 +1131,26 @@ struct dict_index_t{ vers_history_row(const rec_t* rec, bool &history_row); }; +/** Detach a column from an index. +@param[in] index index to be detached from */ +inline void dict_col_t::detach(const dict_index_t& index) +{ + if (!is_virtual()) { + return; + } + + if (dict_v_idx_list* v_indexes = reinterpret_cast<const dict_v_col_t*> + (this)->v_indexes) { + for (dict_v_idx_list::iterator i = v_indexes->begin(); + i != v_indexes->end(); i++) { + if (i->index == &index) { + v_indexes->erase(i); + return; + } + } + } +} + /** The status of online index creation */ enum online_index_status { /** the index is complete and ready for access */ |