From 40dce922cc9940812f172fbed116da9a3606bd5a Mon Sep 17 00:00:00 2001 From: marko <> Date: Mon, 10 Dec 2007 12:54:53 +0000 Subject: [PATCH] branches/zip: buf_page_get_gen(): Check the return status of buf_zip_decompress() and return NULL on decompression failure. --- buf/buf0buf.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/buf/buf0buf.c b/buf/buf0buf.c index 72af105573c..53a63a3b804 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -1712,7 +1712,6 @@ buf_page_get_gen( buf_block_t* block; ibool accessed; ulint fix_type; - ibool success; ibool must_read; ut_ad(mtr); @@ -1788,6 +1787,7 @@ loop2: switch (buf_block_get_state(block)) { buf_page_t* bpage; + ibool success; case BUF_BLOCK_FILE_PAGE: break; @@ -1904,9 +1904,12 @@ wait_until_unfixed: /* Decompress the page and apply buffered operations while not holding buf_pool->mutex or block->mutex. */ - buf_zip_decompress(block, srv_use_checksums); - ibuf_merge_or_delete_for_page(block, space, offset, - zip_size, TRUE); + success = buf_zip_decompress(block, srv_use_checksums); + + if (UNIV_LIKELY(success)) { + ibuf_merge_or_delete_for_page(block, space, offset, + zip_size, TRUE); + } /* Unfix and unlatch the block. */ mutex_enter(&buf_pool->mutex); @@ -1917,6 +1920,12 @@ wait_until_unfixed: mutex_exit(&block->mutex); rw_lock_x_unlock(&block->lock); + if (UNIV_UNLIKELY(!success)) { + + mutex_exit(&buf_pool->mutex); + return(NULL); + } + break; case BUF_BLOCK_ZIP_FREE: @@ -1957,6 +1966,8 @@ wait_until_unfixed: #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ if (mode == BUF_GET_NOWAIT) { + ibool success; + if (rw_latch == RW_S_LATCH) { success = rw_lock_s_lock_func_nowait(&(block->lock), file, line);