Commit ac05c89b authored by marko's avatar marko

branches/zip: buf_block_align(): Remove from non-debug builds.

btr_search_guess_on_hash(), btr_search_validate(): Instead of
buf_block_align(), call buf_page_hash_get(), and allow it to return NULL.
parent 7b6b235c
...@@ -696,7 +696,7 @@ btr_search_guess_on_hash( ...@@ -696,7 +696,7 @@ btr_search_guess_on_hash(
{ {
buf_block_t* block; buf_block_t* block;
rec_t* rec; rec_t* rec;
page_t* page; const page_t* page;
ulint fold; ulint fold;
ulint tuple_n_fields; ulint tuple_n_fields;
dulint index_id; dulint index_id;
...@@ -756,10 +756,27 @@ btr_search_guess_on_hash( ...@@ -756,10 +756,27 @@ btr_search_guess_on_hash(
goto failure_unlock; goto failure_unlock;
} }
mutex_enter(&buf_pool->mutex); page = page_align((rec_t*) rec);
block = buf_block_align(rec); {
mutex_exit(&buf_pool->mutex); ulint page_no = page_get_page_no(page);
page = page_align(rec); ulint space_id = page_get_space_id(page);
mutex_enter(&buf_pool->mutex);
block = buf_page_hash_get(space_id, page_no);
mutex_exit(&buf_pool->mutex);
}
if (UNIV_UNLIKELY(!block)) {
/* The block is most probably being freed.
The function buf_LRU_search_and_free_block()
first removes the block from buf_pool->page_hash
by calling buf_LRU_block_remove_hashed_page().
After that, it invokes btr_search_drop_page_hash_index().
Let us pretend that the block was also removed from
the adaptive hash index. */
goto failure_unlock;
}
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
...@@ -1627,9 +1644,29 @@ btr_search_validate(void) ...@@ -1627,9 +1644,29 @@ btr_search_validate(void)
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node; node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
while (node != NULL) { for (; node != NULL; node = node->next) {
block = buf_block_align(node->data);
page = page_align(node->data); page = page_align(node->data);
{
ulint page_no = page_get_page_no(page);
ulint space_id= page_get_space_id(page);
block = buf_page_hash_get(space_id, page_no);
}
if (UNIV_UNLIKELY(!block)) {
/* The block is most probably being freed.
The function buf_LRU_search_and_free_block()
first removes the block from
buf_pool->page_hash by calling
buf_LRU_block_remove_hashed_page().
After that, it invokes
btr_search_drop_page_hash_index().
Let us pretend that the block was also removed
from the adaptive hash index. */
continue;
}
offsets = rec_get_offsets((rec_t*) node->data, offsets = rec_get_offsets((rec_t*) node->data,
block->index, offsets, block->index, offsets,
block->curr_n_fields block->curr_n_fields
...@@ -1682,8 +1719,6 @@ btr_search_validate(void) ...@@ -1682,8 +1719,6 @@ btr_search_validate(void)
n_page_dumps++; n_page_dumps++;
} }
} }
node = node->next;
} }
} }
......
...@@ -558,6 +558,7 @@ buf_block_get_page_zip( ...@@ -558,6 +558,7 @@ buf_block_get_page_zip(
/* out: compressed page descriptor, or NULL */ /* out: compressed page descriptor, or NULL */
buf_block_t* block) /* in: pointer to the control block */ buf_block_t* block) /* in: pointer to the control block */
__attribute((const)); __attribute((const));
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*********************************************************************** /***********************************************************************
Gets the block to whose frame the pointer is pointing to. */ Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE UNIV_INLINE
...@@ -566,7 +567,6 @@ buf_block_align( ...@@ -566,7 +567,6 @@ buf_block_align(
/*============*/ /*============*/
/* out: pointer to block */ /* out: pointer to block */
byte* ptr); /* in: pointer to a frame */ byte* ptr); /* in: pointer to a frame */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/************************************************************************* /*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */ if applicable. */
......
...@@ -188,6 +188,7 @@ buf_block_get_page_zip( ...@@ -188,6 +188,7 @@ buf_block_get_page_zip(
return(NULL); return(NULL);
} }
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*********************************************************************** /***********************************************************************
Gets the block to whose frame the pointer is pointing to. */ Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE UNIV_INLINE
...@@ -210,7 +211,6 @@ buf_block_align( ...@@ -210,7 +211,6 @@ buf_block_align(
return(block); return(block);
} }
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/************************************************************************* /*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */ if applicable. */
......
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