Skip to content

Commit dbee7b7

Browse files
committed
MDEV-36863 InnoDB: Failing assertion: !block->n_hash_helps after failing to shrink innodb_buffer_pool_size
buf_pool_t::resize(): After failing to shrink the buffer pool, clear any adaptive hash index fields for blocks that were restored from buf_pool.withdrawn to buf_pool.free, so that they will be in the expected state when the blocks will be allocated later. This fixes a logic conflict between commit 4dcb1b5 (MDEV-35049) and commit b692342 (MDEV-29445).
1 parent d953f2c commit dbee7b7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,19 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept
20782078
ut_d(b->in_free_list= true);
20792079
ut_ad(b->state() == buf_page_t::NOT_USED);
20802080
b->lock.init();
2081+
#ifdef BTR_CUR_HASH_ADAPT
2082+
/* Clear the AHI fields, because buf_block_init_low() expects
2083+
these to be zeroed. These were not cleared when we relocated
2084+
the block to withdrawn. Had we successfully shrunk the buffer pool,
2085+
all this virtual memory would have been zeroed or made unaccessible,
2086+
and on a subsequent buffer pool extension it would be zero again. */
2087+
buf_block_t *block= reinterpret_cast<buf_block_t*>(b);
2088+
block->n_hash_helps= 0;
2089+
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
2090+
block->n_pointers= 0;
2091+
# endif
2092+
block->index= nullptr;
2093+
#endif
20812094
}
20822095

20832096
mysql_mutex_unlock(&mutex);

0 commit comments

Comments
 (0)