From 93634462e5802cbe728919a1bfea56cc3cb27271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Sep 2018 23:50:45 +0300 Subject: Remove dict_col_t::dropped dict_col_t::DROPPED: Magic value for dict_col_t::ind --- storage/innobase/dict/dict0mem.cc | 8 +++----- storage/innobase/handler/handler0alter.cc | 3 +-- storage/innobase/include/dict0mem.h | 11 +++++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index c05fc9a4c8e..cfc4066ce22 100755 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -713,9 +713,9 @@ dict_mem_fill_column_struct( dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); column->mbminlen = mbminlen; column->mbmaxlen = mbmaxlen; - column->dropped = false; column->def_val.data = NULL; column->def_val.len = UNIV_SQL_DEFAULT; + ut_ad(!column->is_dropped()); } /**********************************************************************//** @@ -1337,8 +1337,7 @@ inline void dict_index_t::instant_add_field(const dict_index_t& instant) DBUG_ASSERT(!icol->is_virtual()); if (icol->is_dropped()) { ut_d(n_dropped++); - f.col->dropped = true; - f.col->ind = 0; + f.col->set_dropped(); f.name = NULL; } else { f.col = &table->cols[icol - instant.table->cols]; @@ -1596,11 +1595,10 @@ void dict_table_t::construct_dropped_columns(const byte* data) for (unsigned i = 0; i < n_dropped_cols; i++) { dict_col_t& drop_col = dropped_cols[i]; bool is_fixed = false; - drop_col.dropped = true; + drop_col.set_dropped(); while (j < num_non_pk_fields) { if (non_pk_col_map[j++] == 0) { - drop_col.ind = j + clust_index->n_uniq + 1; break; } } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 997b517ade9..572ef18da32 100755 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -369,8 +369,7 @@ add_metadata: (&instant_table->instant ->dropped[d++]) dict_col_t(old_table->cols[i]); - drop->dropped = true; - drop->ind = 0; + drop->set_dropped(); } } #ifndef DBUG_OFF diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 5d4aa6ea0d6..9752f7eda8e 100755 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -587,9 +587,10 @@ struct dict_col_t{ this column. Our current max limit is 3072 (REC_VERSION_56_MAX_INDEX_COL_LEN) bytes. */ - - /** Whether the column has been instantly dropped. */ - unsigned dropped:1; +private: + /** Special value of ind for a dropped column */ + static const unsigned DROPPED = 1023; +public: /** Detach the column from an index. @param[in] index index to be detached from */ @@ -649,8 +650,10 @@ struct dict_col_t{ DBUG_ASSERT(def_val.len != UNIV_SQL_DEFAULT || !def_val.data); return def_val.len != UNIV_SQL_DEFAULT; } + /** Flag the column instantly dropped */ + void set_dropped() { ind = DROPPED; } /** @return whether the column was instantly dropped */ - bool is_dropped() const { return dropped; } + bool is_dropped() const { return ind == DROPPED; } /** @return whether the column was instantly dropped @param[in] index the clustered index */ inline bool is_dropped(const dict_index_t& index) const; -- cgit v1.2.1