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

buf_fix_count.  This could explain Issue #156.
Tested by Michael.
This commit is contained in:
marko 2009-06-29 08:24:27 +00:00
parent e3abdf8239
commit cc50421173
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,10 @@
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:

View file

@ -2085,12 +2085,15 @@ loop2:
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 @@ wait_until_unfixed:
/* Allocate an uncompressed page. */
buf_pool_mutex_exit();
mutex_exit(&buf_pool_zip_mutex);
block = buf_LRU_get_free_block(0);
ut_a(block);