Commit b90dd162 authored by Marko Mäkelä's avatar Marko Mäkelä

In TRUNCATE TABLE, clear the 'instant' status of a table. TODO: Do the same...

In TRUNCATE TABLE, clear the 'instant' status of a table. TODO: Do the same when the table becomes empty

dict_col_t::remove_instant(): Remove the instantness of a column.

dict_index_t::remove_instant(): Remove the instantness of a clustered index.
parent 2cd1f7c2
......@@ -645,6 +645,14 @@ struct dict_col_t{
*len = def_val.len;
return static_cast<const byte*>(def_val.data);
}
/** Remove the 'instant ADD' status of the column */
void remove_instant()
{
DBUG_ASSERT(is_instant());
def_val.len = UNIV_SQL_DEFAULT;
def_val.data = NULL;
}
};
/** Index information put in a list of virtual column structure. Index
......@@ -1059,6 +1067,16 @@ struct dict_index_t{
return fields[n].col->instant_value(len);
}
/** Remove the 'instant ADD' status of a clustered index */
void remove_instant()
{
DBUG_ASSERT(is_clust());
for (unsigned i = n_core_fields; i < n_fields; i++) {
fields[i].col->remove_instant();
}
n_core_fields = n_fields;
}
/** Check whether two indexes have the same metadata.
@param[in] old the other index
@param[in] add whether to ignore added fields in other
......
......@@ -1882,6 +1882,8 @@ row_truncate_table_for_mysql(
we need to use index locks to sync up */
dict_table_x_lock_indexes(table);
dict_table_get_first_index(table)->remove_instant();
if (!dict_table_is_temporary(table)) {
if (is_file_per_table) {
......@@ -1950,17 +1952,12 @@ row_truncate_table_for_mysql(
return(row_truncate_complete(
table, trx, fsp_flags, logger, DB_ERROR));
}
}
DBUG_EXECUTE_IF("ib_trunc_crash_after_redo_log_write_complete",
log_buffer_flush_to_disk();
os_thread_sleep(3000000);
DBUG_SUICIDE(););
/* Step-9: Drop all indexes (free index pages associated with these
indexes) */
if (!dict_table_is_temporary(table)) {
DropIndex dropIndex(table, no_redo);
err = SysIndexIterator().for_each(dropIndex);
......@@ -2108,6 +2105,8 @@ row_truncate_table_for_mysql(
trx_commit_for_mysql(trx);
}
ut_ad(!table->is_instant());
return(row_truncate_complete(table, trx, fsp_flags, logger, err));
}
......
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