From a2c56cdf04a3749908c4baf2b5262321e8893e5c Mon Sep 17 00:00:00 2001 From: marko Date: Tue, 27 Jan 2009 22:46:13 +0000 Subject: [PATCH] branches/zip: btr_search_validate(): Fix an assertion failure that was introduced in r4036. Do not call buf_block_get_space(), buf_block_get_page_no() unless the block state is BUF_BLOCK_FILE_PAGE. This bug was reported by Michael. --- btr/btr0sea.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/btr/btr0sea.c b/btr/btr0sea.c index 2c197f96be4..afcd46c75b4 100644 --- a/btr/btr0sea.c +++ b/btr/btr0sea.c @@ -1703,10 +1703,22 @@ btr_search_validate(void) for (; node != NULL; node = node->next) { const buf_block_t* block = buf_block_align(node->data); - const buf_block_t* hash_block - = buf_block_hash_get( + const buf_block_t* hash_block; + + if (UNIV_LIKELY(buf_block_get_state(block) + == BUF_BLOCK_FILE_PAGE)) { + + /* The space and offset are only valid + for file blocks. It is possible that + the block is being freed + (BUF_BLOCK_REMOVE_HASH, see the + assertion and the comment below) */ + hash_block = buf_block_hash_get( buf_block_get_space(block), buf_block_get_page_no(block)); + } else { + hash_block = NULL; + } if (hash_block) { ut_a(hash_block == block);