From 0057dab13e8086fbc84c4404706613da4c5e9cc5 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 12 Jan 2009 16:56:11 +0000 Subject: [PATCH] branches/zip: Non-functional change: Add some debug assertions and comments. buf_page_t: Note that the LRU fields are protected by buf_pool_mutex only, not block->mutex or buf_pool_zip_mutex. buf_page_get_freed_page_clock(): Note that this is sometimes invoked without mutex protection. buf_pool_get_oldest_modification(): Note that the result may be out of date. buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer pool mutex is being held. buf_page_release(): Assert that dirty blocks are in the flush list. --- include/buf0buf.h | 3 ++- include/buf0buf.ic | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/buf0buf.h b/include/buf0buf.h index c99c67e5eeb..54c684c496f 100644 --- a/include/buf0buf.h +++ b/include/buf0buf.h @@ -1053,7 +1053,8 @@ struct buf_page_struct{ not yet been flushed on disk; zero if all modifications are on disk */ - /* 3. LRU replacement algorithm fields; protected by buf_pool_mutex */ + /* 3. LRU replacement algorithm fields; protected by + buf_pool_mutex only (not buf_pool_zip_mutex or block->mutex) */ UT_LIST_NODE_T(buf_page_t) LRU; /* node of the LRU list */ diff --git a/include/buf0buf.ic b/include/buf0buf.ic index 885edc25ac8..42aff7e2a23 100644 --- a/include/buf0buf.ic +++ b/include/buf0buf.ic @@ -20,6 +20,7 @@ buf_page_get_freed_page_clock( /* out: freed_page_clock */ const buf_page_t* bpage) /* in: block */ { + /* This is sometimes read without holding buf_pool_mutex. */ return(bpage->freed_page_clock); } @@ -89,6 +90,9 @@ buf_pool_get_oldest_modification(void) buf_pool_mutex_exit(); + /* The returned answer may be out of date: the flush_list can + change after the mutex has been released. */ + return(lsn); } @@ -261,6 +265,7 @@ buf_page_get_LRU_position( const buf_page_t* bpage) /* in: control block */ { ut_ad(buf_page_in_file(bpage)); + ut_ad(buf_pool_mutex_own()); return(bpage->LRU_position); } @@ -429,6 +434,7 @@ buf_page_is_old( const buf_page_t* bpage) /* in: control block */ { ut_ad(buf_page_in_file(bpage)); + ut_ad(buf_pool_mutex_own()); return(bpage->old); } @@ -1041,6 +1047,10 @@ buf_page_release( #endif block->page.buf_fix_count--; + /* Dirty blocks should be in the flush list. */ + ut_ad(!block->page.oldest_modification + || block->page.in_flush_list); + mutex_exit(&block->mutex); if (rw_latch == RW_S_LATCH) {