summaryrefslogtreecommitdiff
path: root/storage/innobase/handler/handler0alter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/handler/handler0alter.cc')
-rw-r--r--storage/innobase/handler/handler0alter.cc43
1 files changed, 17 insertions, 26 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 940e5a55d39..546a79223fd 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -160,7 +160,7 @@ static void instant_metadata_lock(dict_index_t& index, mtr_t& mtr)
ut_ad(!buf_block_get_page_zip(btr_cur_get_block(&btr_cur)));
}
-/** Initialize instant->non_pk_col_map.
+/** Initialize instant->field_map.
@tparam replace_dropped whether to point clustered index fields
to instant->dropped[]
@param[in] table table definition to copy from */
@@ -174,10 +174,10 @@ inline void dict_table_t::init_instant(const dict_table_t& table)
DBUG_ASSERT(not_redundant() == table.not_redundant());
DBUG_ASSERT(index.n_fields >= oindex.n_fields);
- uint16_t* non_pk_col_map = static_cast<uint16_t*>(
+ field_map_element_t* field_map_it = static_cast<field_map_element_t*>(
mem_heap_zalloc(heap, (index.n_fields - u)
- * sizeof *non_pk_col_map));
- instant->non_pk_col_map = non_pk_col_map;
+ * sizeof *field_map_it));
+ instant->field_map = field_map_it;
ut_d(unsigned n_drop = 0);
ut_d(unsigned n_nullable = 0);
@@ -185,32 +185,23 @@ inline void dict_table_t::init_instant(const dict_table_t& table)
auto& f = index.fields[i];
DBUG_ASSERT(dict_col_get_fixed_size(f.col, not_redundant())
<= DICT_MAX_FIXED_COL_LEN);
-#ifdef UNIV_DEBUG
- if (!f.col->is_nullable()) {
- ut_ad((*non_pk_col_map & 3U << 15) != 1U << 14);
- } else if ((*non_pk_col_map & 3U << 15) != 1U << 14) {
- n_nullable++;
- }
-#endif
+ ut_d(n_nullable += f.col->is_nullable());
+
if (!f.col->is_dropped()) {
- auto c = *non_pk_col_map & 3U << 14;
- DBUG_ASSERT(!(c & 1U << 15));
- if (!c
- && f.col->is_nullable()
- && !oindex.fields[i].col->is_nullable()) {
- c = 1U << 14;
- }
- *non_pk_col_map++ = c | f.col->ind;
+ (*field_map_it++).set_ind(f.col->ind);
continue;
}
auto fixed_len = dict_col_get_fixed_size(
f.col, not_redundant());
- *non_pk_col_map++ = 1U << 15
- | uint16_t(!f.col->is_nullable()) << 14
- | (fixed_len
- ? uint16_t(fixed_len + 1)
- : f.col->len > 255);
+ field_map_it->set_dropped();
+ if (!f.col->is_nullable()) {
+ field_map_it->set_not_null();
+ }
+ field_map_it->set_ind(fixed_len
+ ? uint16_t(fixed_len + 1)
+ : f.col->len > 255);
+ field_map_it++;
ut_ad(f.col >= table.instant->dropped);
ut_ad(f.col < table.instant->dropped
+ table.instant->n_dropped);
@@ -223,7 +214,7 @@ inline void dict_table_t::init_instant(const dict_table_t& table)
}
}
ut_ad(n_drop == n_dropped());
- ut_ad(non_pk_col_map == &instant->non_pk_col_map[index.n_fields - u]);
+ ut_ad(field_map_it == &instant->field_map[index.n_fields - u]);
ut_ad(index.n_nullable == n_nullable);
}
@@ -5275,7 +5266,7 @@ void dict_table_t::serialise_columns(mem_heap_t* heap, dfield_t* field) const
data += 4;
for (ulint i = n_fixed; i < index.n_fields; i++) {
- mach_write_to_2(data, instant->non_pk_col_map[i - n_fixed]);
+ mach_write_to_2(data, instant->field_map[i - n_fixed]);
data += 2;
}
}