summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-08-25 15:14:38 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-08-25 15:14:38 +0300
commitd1a80c42ee5b9c845ca72288d3bc58b47f5632a3 (patch)
tree8cf257a4d61990c816b22398b0a1054cc59bc988
parent2f6a728075a08c70103fa559180d0efc39f86fd4 (diff)
downloadmariadb-git-d1a80c42ee5b9c845ca72288d3bc58b47f5632a3.tar.gz
MDEV-29384 Hangs caused by innodb_adaptive_hash_index=ON
buf_defer_drop_ahi(): Remove. Ever since commit c7f8cfc9e733517cff4aaa6f6eaca625a3afc098 (MDEV-27700) it is safe to invoke btr_search_drop_page_hash_index(block, true) to remove an orphan adaptive hash index. Any attempt to upgrade page latches is prone to deadlocks. Recently, we observed a few hangs that involved nothing more than a small table consisting of one clustered index page, one secondary index page and some undo pages.
-rw-r--r--storage/innobase/buf/buf0buf.cc41
1 files changed, 1 insertions, 40 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 8658b3a4a89..eb57489172c 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -3917,42 +3917,6 @@ buf_wait_for_read(
}
}
-#ifdef BTR_CUR_HASH_ADAPT
-/** If a stale adaptive hash index exists on the block, drop it.
-Multiple executions of btr_search_drop_page_hash_index() on the
-same block must be prevented by exclusive page latch. */
-ATTRIBUTE_COLD
-static void buf_defer_drop_ahi(buf_block_t *block, mtr_memo_type_t fix_type)
-{
- switch (fix_type) {
- case MTR_MEMO_BUF_FIX:
- /* We do not drop the adaptive hash index, because safely doing
- so would require acquiring block->lock, and that is not safe
- to acquire in some RW_NO_LATCH access paths. Those code paths
- should have no business accessing the adaptive hash index anyway. */
- break;
- case MTR_MEMO_PAGE_S_FIX:
- /* Temporarily release our S-latch. */
- rw_lock_s_unlock(&block->lock);
- rw_lock_x_lock(&block->lock);
- btr_search_drop_page_hash_index(block, true);
- rw_lock_x_unlock(&block->lock);
- rw_lock_s_lock(&block->lock);
- break;
- case MTR_MEMO_PAGE_SX_FIX:
- rw_lock_sx_unlock(&block->lock);
- rw_lock_x_lock(&block->lock);
- btr_search_drop_page_hash_index(block, true);
- rw_lock_x_unlock(&block->lock);
- rw_lock_sx_lock(&block->lock);
- break;
- default:
- ut_ad(fix_type == MTR_MEMO_PAGE_X_FIX);
- btr_search_drop_page_hash_index(block);
- }
-}
-#endif /* BTR_CUR_HASH_ADAPT */
-
/** Lock the page with the given latch type.
@param[in,out] block block to be locked
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@@ -3988,10 +3952,7 @@ static buf_block_t* buf_page_mtr_lock(buf_block_t *block,
}
#ifdef BTR_CUR_HASH_ADAPT
- {
- if (block->index)
- buf_defer_drop_ahi(block, fix_type);
- }
+ btr_search_drop_page_hash_index(block, true);
#endif /* BTR_CUR_HASH_ADAPT */
done: