Commit ea16688c authored by marko's avatar marko

branches/zip: buf_page_t: Move "old" to the same machine word with

LRU_position and possibly freed_page_clock.  All these fields are
protected by buf_pool->mutex rather than buf_page_get_mutex().

buf_page_set_accessed(): Add a mutex_own() assertion.
parent db71ab1c
...@@ -896,8 +896,6 @@ struct buf_page_struct{ ...@@ -896,8 +896,6 @@ struct buf_page_struct{
ulint flush_type:2; /* if this block is currently being ulint flush_type:2; /* if this block is currently being
flushed to disk, this tells the flushed to disk, this tells the
flush_type (@see enum buf_flush) */ flush_type (@see enum buf_flush) */
ulint old:1; /* TRUE if the block is in the old
blocks in the LRU list */
ulint accessed:1; /* TRUE if the page has been accessed ulint accessed:1; /* TRUE if the page has been accessed
while in the buffer pool: read-ahead while in the buffer pool: read-ahead
may read in pages which have not been may read in pages which have not been
...@@ -907,7 +905,7 @@ struct buf_page_struct{ ...@@ -907,7 +905,7 @@ struct buf_page_struct{
ulint io_fix:2; /* type of pending I/O operation ulint io_fix:2; /* type of pending I/O operation
(@see enum buf_io_fix); also (@see enum buf_io_fix); also
protected by buf_pool->mutex */ protected by buf_pool->mutex */
ulint buf_fix_count:23;/* count of how manyfold this block ulint buf_fix_count:24;/* count of how manyfold this block
is currently bufferfixed */ is currently bufferfixed */
page_zip_des_t zip; /* compressed page */ page_zip_des_t zip; /* compressed page */
...@@ -930,8 +928,7 @@ struct buf_page_struct{ ...@@ -930,8 +928,7 @@ struct buf_page_struct{
not yet been flushed on disk; zero if not yet been flushed on disk; zero if
all modifications are on disk */ 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 */
unless otherwise noted*/
UT_LIST_NODE_T(buf_page_t) LRU; UT_LIST_NODE_T(buf_page_t) LRU;
/* node of the LRU list */ /* node of the LRU list */
...@@ -939,21 +936,23 @@ struct buf_page_struct{ ...@@ -939,21 +936,23 @@ struct buf_page_struct{
ibool in_LRU_list; /* TRUE of the page is in the LRU list; ibool in_LRU_list; /* TRUE of the page is in the LRU list;
used in debugging */ used in debugging */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ulint LRU_position; /* value which monotonically ulint old:1; /* TRUE if the block is in the old
decreases (or may stay constant if blocks in the LRU list */
the block is in the old blocks) toward ulint LRU_position:31;/* value which monotonically decreases
the end of the LRU list, if the pool (or may stay constant if old==TRUE)
ulint_clock has not wrapped around: toward the end of the LRU list, if
NOTE that this value can only be used buf_pool->ulint_clock has not wrapped
in heuristic algorithms, because of around: NOTE that this value can only
the possibility of a wrap-around! */ be used in heuristic algorithms,
ulint freed_page_clock;/* the value of freed_page_clock because of the possibility of a
of the buffer pool when this block was wrap-around! */
the last time put to the head of the ulint freed_page_clock:32;/* the value of
LRU list; protected by buf_pool->mutex; buf_pool->freed_page_clock when this
a thread is allowed to read this for block was the last time put to the
heuristic purposes without holding any head of the LRU list; a thread is
mutex or latch */ allowed to read this for heuristic
purposes without holding any mutex or
latch */
#ifdef UNIV_DEBUG_FILE_ACCESSES #ifdef UNIV_DEBUG_FILE_ACCESSES
ibool file_page_was_freed; ibool file_page_was_freed;
/* this is set to TRUE when fsp /* this is set to TRUE when fsp
......
...@@ -397,7 +397,7 @@ buf_page_set_old( ...@@ -397,7 +397,7 @@ buf_page_set_old(
{ {
ut_a(buf_page_in_file(bpage)); ut_a(buf_page_in_file(bpage));
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(buf_page_get_mutex(bpage))); ut_a(mutex_own(&buf_pool->mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
bpage->old = old; bpage->old = old;
...@@ -427,6 +427,9 @@ buf_page_set_accessed( ...@@ -427,6 +427,9 @@ buf_page_set_accessed(
ibool accessed) /* in: accessed */ ibool accessed) /* in: accessed */
{ {
ut_a(buf_page_in_file(bpage)); ut_a(buf_page_in_file(bpage));
#ifdef UNIV_SYNC_DEBUG
ut_a(mutex_own(buf_page_get_mutex(bpage)));
#endif /* UNIV_SYNC_DEBUG */
bpage->accessed = accessed; bpage->accessed = accessed;
} }
......
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