diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index cc567ec73c8..0a227f6b68c 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1498,7 +1498,7 @@ buf_block_init( /* This function should only be executed at database startup or by buf_pool_resize(). Either way, adaptive hash index must not exist. */ - assert_block_ahi_empty(block); + assert_block_ahi_empty_on_init(block); block->frame = frame; @@ -2246,7 +2246,7 @@ buf_page_realloc( /* This code should only be executed by buf_pool_resize(), while the adaptive hash index is disabled. */ assert_block_ahi_empty(block); - assert_block_ahi_empty(new_block); + assert_block_ahi_empty_on_init(new_block); ut_ad(!block->index); new_block->index = NULL; new_block->n_hash_helps = 0; @@ -3923,7 +3923,7 @@ buf_block_init_low( #ifdef BTR_CUR_HASH_ADAPT /* No adaptive hash index entries may point to a previously unused (and now freshly allocated) block. */ - assert_block_ahi_empty(block); + assert_block_ahi_empty_on_init(block); block->index = NULL; block->n_hash_helps = 0; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index aaadd544315..6832c133d58 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1877,11 +1877,16 @@ struct buf_block_t{ or btr_search_own_all(). */ # define assert_block_ahi_empty(block) \ ut_a(my_atomic_addlint(&(block)->n_pointers, 0) == 0) +# define assert_block_ahi_empty_on_init(block) do { \ + UNIV_MEM_VALID(&(block)->n_pointers, sizeof (block)->n_pointers); \ + assert_block_ahi_empty(block); \ +} while (0) # define assert_block_ahi_valid(block) \ ut_a((block)->index \ || my_atomic_addlint(&(block)->n_pointers, 0) == 0) # else /* UNIV_AHI_DEBUG || UNIV_DEBUG */ # define assert_block_ahi_empty(block) /* nothing */ +# define assert_block_ahi_empty_on_init(block) /* nothing */ # define assert_block_ahi_valid(block) /* nothing */ # endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ unsigned curr_n_fields:10;/*!< prefix length for hash indexing: @@ -1901,6 +1906,7 @@ struct buf_block_t{ /* @} */ #else /* BTR_CUR_HASH_ADAPT */ # define assert_block_ahi_empty(block) /* nothing */ +# define assert_block_ahi_empty_on_init(block) /* nothing */ # define assert_block_ahi_valid(block) /* nothing */ #endif /* BTR_CUR_HASH_ADAPT */ bool skip_flush_check;