MDEV-30802 Assertion `index->is_btree() || index->is_ibuf()' failed in btr_search_guess_on_hash

Problem:
=======
 - There is a race condition between purge and rollback of alter
operation. Alter rollback marks the index as corrupted.
At the same time, purge is working on the same index and leads
to assert failure. This is caused by
commit 7c0b9c60 (MDEV-15250).

Solution:
=======
 - After MDEV-15250, InnoDB logs the operation only at the
end of transaction commit and applies the log in
ha_innobase::commit_inplace_alter_table() and
also via dml thread. So there is no need for purge to work
on uncommitted index.

The assertion would fail in the test innodb.innodb-index-online
when the following call is added to the start of the function
row_purge_remove_sec_if_poss_leaf():
if (!index->is_committed()) sleep(5);
parent 8096139b
...@@ -1052,7 +1052,8 @@ struct dict_index_t { ...@@ -1052,7 +1052,8 @@ struct dict_index_t {
unsigned uncommitted:1; unsigned uncommitted:1;
/*!< a flag that is set for secondary indexes /*!< a flag that is set for secondary indexes
that have not been committed to the that have not been committed to the
data dictionary yet */ data dictionary yet. Protected by
MDL */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** whether this is a dummy index object */ /** whether this is a dummy index object */
......
...@@ -613,13 +613,9 @@ row_purge_del_mark( ...@@ -613,13 +613,9 @@ row_purge_del_mark(
do do
{ {
const auto type= node->index->type; if (node->index->type & (DICT_FTS | DICT_CORRUPT))
if (type & (DICT_FTS | DICT_CORRUPT))
continue; continue;
if (node->index->online_status > ONLINE_INDEX_CREATION) if (!node->index->is_committed())
continue;
if (UNIV_UNLIKELY(DICT_VIRTUAL & type) && !node->index->is_committed() &&
node->index->has_new_v_col())
continue; continue;
dtuple_t* entry= row_build_index_entry_low(node->row, nullptr, dtuple_t* entry= row_build_index_entry_low(node->row, nullptr,
node->index, heap, node->index, heap,
...@@ -768,20 +764,11 @@ row_purge_upd_exist_or_extern_func( ...@@ -768,20 +764,11 @@ row_purge_upd_exist_or_extern_func(
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
do { do {
const auto type = node->index->type; if (node->index->type & (DICT_FTS | DICT_CORRUPT)) {
if (type & (DICT_FTS | DICT_CORRUPT)) {
continue;
}
if (UNIV_UNLIKELY(DICT_VIRTUAL & type)
&& !node->index->is_committed()
&& node->index->has_new_v_col()) {
continue; continue;
} }
if (node->index->online_status if (!node->index->is_committed()) {
> ONLINE_INDEX_CREATION) {
continue; continue;
} }
......
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