Commit 3b2806f4 authored by marko's avatar marko

branches/zip: Add the debug function buf_pool_contains_zip() #ifdef UNIV_DEBUG.

parent 483cf9be
......@@ -704,6 +704,65 @@ buf_chunk_init(
return(chunk);
}
#ifdef UNIV_DEBUG
/*************************************************************************
Finds a block in the given buffer chunk that points to a
given compressed page. */
static
buf_block_t*
buf_chunk_contains_zip(
/*===================*/
/* out: buffer block pointing to
the compressed page, or NULL */
buf_chunk_t* chunk, /* in: chunk being checked */
const void* data) /* in: pointer to compressed page */
{
buf_block_t* block;
ulint i;
ut_ad(buf_pool);
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */
block = chunk->blocks;
for (i = chunk->size; i--; block++) {
if (block->page.zip.data == data) {
return(block);
}
}
return(NULL);
}
/*************************************************************************
Finds a block in the buffer pool that points to a
given compressed page. */
buf_block_t*
buf_pool_contains_zip(
/*==================*/
/* out: buffer block pointing to
the compressed page, or NULL */
const void* data) /* in: pointer to compressed page */
{
ulint n;
buf_chunk_t* chunk = buf_pool->chunks;
for (n = buf_pool->n_chunks; n--; chunk++) {
buf_block_t* block = buf_chunk_contains_zip(chunk, data);
if (block) {
return(block);
}
}
return(NULL);
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Checks that all file pages in the buffer chunk are in a replaceable state. */
static
......
......@@ -470,6 +470,18 @@ buf_block_get_lock_hash_val(
/* out: lock hash value */
const buf_block_t* block) /* in: block */
__attribute__((pure));
#ifdef UNIV_DEBUG
/*************************************************************************
Finds a block in the buffer pool that points to a
given compressed page. */
buf_block_t*
buf_pool_contains_zip(
/*==================*/
/* out: buffer block pointing to
the compressed page, or NULL */
const void* data); /* in: pointer to compressed page */
#endif /* UNIV_DEBUG */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/*************************************************************************
Validates the buffer pool data structure. */
......
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