Commit 17105a0a authored by marko's avatar marko

branches/zip: buf_page_get_gen(): Fix a race condition when reading

buf_fix_count.  This could explain Issue #156.
Tested by Michael.
parent 3bc2b8f1
2009-06-29 The InnoDB Team
* buf/buf0buf.c:
Fix a race condition when reading buf_fix_count.
Currently, it is not being protected by the buffer pool mutex,
but by the block mutex.
2009-06-29 The InnoDB Team 2009-06-29 The InnoDB Team
* handler/handler0alter.cc: * handler/handler0alter.cc:
......
...@@ -2085,12 +2085,15 @@ loop2: ...@@ -2085,12 +2085,15 @@ loop2:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
bpage = &block->page; bpage = &block->page;
/* Protect bpage->buf_fix_count. */
mutex_enter(&buf_pool_zip_mutex);
if (bpage->buf_fix_count if (bpage->buf_fix_count
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) { || buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* This condition often occurs when the buffer /* This condition often occurs when the buffer
is not buffer-fixed, but I/O-fixed by is not buffer-fixed, but I/O-fixed by
buf_page_init_for_read(). */ buf_page_init_for_read(). */
mutex_exit(&buf_pool_zip_mutex);
wait_until_unfixed: wait_until_unfixed:
/* The block is buffer-fixed or I/O-fixed. /* The block is buffer-fixed or I/O-fixed.
Try again later. */ Try again later. */
...@@ -2102,6 +2105,7 @@ wait_until_unfixed: ...@@ -2102,6 +2105,7 @@ wait_until_unfixed:
/* Allocate an uncompressed page. */ /* Allocate an uncompressed page. */
buf_pool_mutex_exit(); buf_pool_mutex_exit();
mutex_exit(&buf_pool_zip_mutex);
block = buf_LRU_get_free_block(0); block = buf_LRU_get_free_block(0);
ut_a(block); ut_a(block);
......
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