Commit 5482fa25 authored by Marko Mäkelä's avatar Marko Mäkelä

commit_cache_rebuild(): Finish instant DROP COLUMN

parent 59b90720
......@@ -1540,29 +1540,6 @@ void dict_table_t::serialise_columns(mem_heap_t* heap, dfield_t* field) const
}
}
/** Flag the column instantly dropped.
@param[in] not_null whether the column was NOT NULL
@param[in] len2 whether the length exceeds 255 bytes
@param[in] fixed the fixed length in bytes, or 0 */
inline void dict_col_t::set_dropped(bool not_null, bool len2, unsigned fixed)
{
DBUG_ASSERT(!len2 || !fixed);
prtype = not_null
? DATA_NOT_NULL | DATA_BINARY_TYPE
: DATA_BINARY_TYPE;
if (fixed) {
mtype = DATA_FIXBINARY;
len = fixed;
} else {
mtype = DATA_BINARY;
len = len2 ? 65535 : 255;
}
mbminlen = mbmaxlen = 0;
ind = DROPPED;
ord_part = 0;
max_prefix = 0;
}
/** Reconstruct dropped or reordered columns.
@param[in] metadata data from serialise_columns()
@param[in] len length of the metadata, in bytes
......
......@@ -9606,6 +9606,19 @@ commit_cache_norebuild(
if (!ctx->is_instant()) {
innobase_rename_or_enlarge_columns_cache(
ha_alter_info, table, ctx->new_table);
} else if (ha_alter_info->handler_flags & ALTER_DROP_STORED_COLUMN) {
dict_index_t* index = dict_table_get_first_index(
ctx->new_table);
for (const dict_field_t* f = index->fields,
* const end = f + index->n_fields;
f != end; f++) {
dict_col_t& c = *f->col;
if (c.is_dropped()) {
c.set_dropped(!c.is_nullable(),
!f->fixed_len && c.len > 255,
f->fixed_len);
}
}
}
if (ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED) {
......
......@@ -645,7 +645,24 @@ struct dict_col_t{
@param[in] not_null whether the column was NOT NULL
@param[in] len2 whether the length exceeds 255 bytes
@param[in] fixed_len the fixed length in bytes, or 0 */
inline void set_dropped(bool not_null, bool len2, unsigned fixed);
void set_dropped(bool not_null, bool len2, unsigned fixed)
{
DBUG_ASSERT(!len2 || !fixed);
prtype = not_null
? DATA_NOT_NULL | DATA_BINARY_TYPE
: DATA_BINARY_TYPE;
if (fixed) {
mtype = DATA_FIXBINARY;
len = fixed;
} else {
mtype = DATA_BINARY;
len = len2 ? 65535 : 255;
}
mbminlen = mbmaxlen = 0;
ind = DROPPED;
ord_part = 0;
max_prefix = 0;
}
/** @return whether the column was instantly dropped */
bool is_dropped() const { return ind == DROPPED; }
/** @return whether the column was instantly dropped
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment