diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2020-08-18 13:41:03 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2020-08-20 11:34:53 +0530 |
commit | e9d6f1c7ac0b33f565301ca1f269a36adc35270b (patch) | |
tree | e105a55bf266fd1c09ea09b03413c48963678740 /storage/innobase | |
parent | 22c4a7512f8dc3f2d2586a856b362ad97ab2bf7d (diff) | |
download | mariadb-git-e9d6f1c7ac0b33f565301ca1f269a36adc35270b.tar.gz |
MDEV-23452 Assertion `buf_page_get_io_fix(bpage) == BUF_IO_NONE' failed
in buf_page_set_sticky
commit a1f899a8abb6bb0b046db28d6da9dd4b7fc3c8c4 (MDEV-23233) added the
code to make page sticky. So that InnoDB can't allow the page to
be grabbed by other thread while doing lazy drop of ahi.
But the block could be in flush list and it could have io_fix value
as BUF_IO_WRITE. It could lead to the failure in buf_page_set_sticky().
buf_page_create(): If btr_search_drop_page_hash_index() must be invoked,
take x-latch on the block. If the block io_fix value is other than
BUF_IO_NONE, release the buffer pool mutex and page hash lock and
wait for I/O to complete.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index ad53a11ea66..a1fd7c48301 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -5591,7 +5591,21 @@ buf_page_create( if (drop_hash_entry) { mutex_enter(&block->mutex); - buf_page_set_sticky(&block->page); + /* Avoid a hang if I/O is going on. Release + the buffer pool mutex and page hash lock + and wait for I/O to complete */ + while (buf_block_get_io_fix(block) != BUF_IO_NONE) { + buf_block_fix(block); + mutex_exit(&block->mutex); + buf_pool_mutex_exit(buf_pool); + rw_lock_x_unlock(hash_lock); + + buf_pool_mutex_enter(buf_pool); + rw_lock_x_lock(hash_lock); + mutex_enter(&block->mutex); + buf_block_unfix(block); + } + rw_lock_x_lock(&block->lock); mutex_exit(&block->mutex); } #endif @@ -5603,11 +5617,7 @@ buf_page_create( #ifdef BTR_CUR_HASH_ADAPT if (drop_hash_entry) { btr_search_drop_page_hash_index(block); - buf_pool_mutex_enter(buf_pool); - mutex_enter(&block->mutex); - buf_page_unset_sticky(&block->page); - mutex_exit(&block->mutex); - buf_pool_mutex_exit(buf_pool); + rw_lock_x_unlock(&block->lock); } #endif /* BTR_CUR_HASH_ADAPT */ |