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
* handler/handler0alter.cc:
......
......@@ -2085,12 +2085,15 @@ buf_page_get_gen(
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
bpage = &block->page;
/* Protect bpage->buf_fix_count. */
mutex_enter(&buf_pool_zip_mutex);
if (bpage->buf_fix_count
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* This condition often occurs when the buffer
is not buffer-fixed, but I/O-fixed by
buf_page_init_for_read(). */
mutex_exit(&buf_pool_zip_mutex);
wait_until_unfixed:
/* The block is buffer-fixed or I/O-fixed.
Try again later. */
......@@ -2102,6 +2105,7 @@ buf_page_get_gen(
/* Allocate an uncompressed page. */
buf_pool_mutex_exit();
mutex_exit(&buf_pool_zip_mutex);
block = buf_LRU_get_free_block(0);
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