summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/buf0buf.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/include/buf0buf.ic')
-rw-r--r--storage/xtradb/include/buf0buf.ic487
1 files changed, 242 insertions, 245 deletions
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index d7ac80becce..1a2b2556839 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -23,79 +23,79 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************
+/**************************************************//**
+@file include/buf0buf.ic
The database buffer buf_pool
Created 11/5/1995 Heikki Tuuri
*******************************************************/
+#include "mtr0mtr.h"
+#ifndef UNIV_HOTBACKUP
#include "buf0flu.h"
#include "buf0lru.h"
#include "buf0rea.h"
-#include "mtr0mtr.h"
-/************************************************************************
-Reads the freed_page_clock of a buffer block. */
+/********************************************************************//**
+Reads the freed_page_clock of a buffer block.
+@return freed_page_clock */
UNIV_INLINE
ulint
buf_page_get_freed_page_clock(
/*==========================*/
- /* out: freed_page_clock */
- const buf_page_t* bpage) /* in: block */
+ const buf_page_t* bpage) /*!< in: block */
{
/* This is sometimes read without holding buf_pool_mutex. */
return(bpage->freed_page_clock);
}
-/************************************************************************
-Reads the freed_page_clock of a buffer block. */
+/********************************************************************//**
+Reads the freed_page_clock of a buffer block.
+@return freed_page_clock */
UNIV_INLINE
ulint
buf_block_get_freed_page_clock(
/*===========================*/
- /* out: freed_page_clock */
- const buf_block_t* block) /* in: block */
+ const buf_block_t* block) /*!< in: block */
{
return(buf_page_get_freed_page_clock(&block->page));
}
-/************************************************************************
+/********************************************************************//**
Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
-mutex. */
+mutex.
+@return TRUE if should be made younger */
UNIV_INLINE
ibool
buf_page_peek_if_too_old(
/*=====================*/
- /* out: TRUE if should be made
- younger */
- const buf_page_t* bpage) /* in: block to make younger */
+ const buf_page_t* bpage) /*!< in: block to make younger */
{
return(buf_pool->freed_page_clock
>= buf_page_get_freed_page_clock(bpage)
+ 1 + (buf_pool->curr_size / 4));
}
-/*************************************************************************
-Gets the current size of buffer buf_pool in bytes. */
+/*********************************************************************//**
+Gets the current size of buffer buf_pool in bytes.
+@return size in bytes */
UNIV_INLINE
ulint
buf_pool_get_curr_size(void)
/*========================*/
- /* out: size in bytes */
{
return(buf_pool->curr_size * UNIV_PAGE_SIZE);
}
-/************************************************************************
+/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
-zero if all modified pages have been flushed to disk. */
+zero if all modified pages have been flushed to disk.
+@return oldest modification in pool, zero if none */
UNIV_INLINE
ib_uint64_t
buf_pool_get_oldest_modification(void)
/*==================================*/
- /* out: oldest modification in pool,
- zero if none */
{
buf_page_t* bpage;
ib_uint64_t lsn;
@@ -126,14 +126,14 @@ try_again:
return(lsn);
}
-/***********************************************************************
+/*******************************************************************//**
Increments the buf_pool clock by one and returns its new value. Remember
-that in the 32 bit version the clock wraps around at 4 billion! */
+that in the 32 bit version the clock wraps around at 4 billion!
+@return new clock value */
UNIV_INLINE
ulint
buf_pool_clock_tic(void)
/*====================*/
- /* out: new clock value */
{
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&LRU_list_mutex));
@@ -142,15 +142,16 @@ buf_pool_clock_tic(void)
return(buf_pool->ulint_clock);
}
+#endif /* !UNIV_HOTBACKUP */
-/*************************************************************************
-Gets the state of a block. */
+/*********************************************************************//**
+Gets the state of a block.
+@return state */
UNIV_INLINE
enum buf_page_state
buf_page_get_state(
/*===============*/
- /* out: state */
- const buf_page_t* bpage) /* in: pointer to the control block */
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
{
enum buf_page_state state = (enum buf_page_state) bpage->state;
@@ -172,25 +173,25 @@ buf_page_get_state(
return(state);
}
-/*************************************************************************
-Gets the state of a block. */
+/*********************************************************************//**
+Gets the state of a block.
+@return state */
UNIV_INLINE
enum buf_page_state
buf_block_get_state(
/*================*/
- /* out: state */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
return(buf_page_get_state(&block->page));
}
-/*************************************************************************
+/*********************************************************************//**
Sets the state of a block. */
UNIV_INLINE
void
buf_page_set_state(
/*===============*/
- buf_page_t* bpage, /* in/out: pointer to control block */
- enum buf_page_state state) /* in: state */
+ buf_page_t* bpage, /*!< in/out: pointer to control block */
+ enum buf_page_state state) /*!< in: state */
{
#ifdef UNIV_DEBUG
enum buf_page_state old_state = buf_page_get_state(bpage);
@@ -229,26 +230,26 @@ buf_page_set_state(
ut_ad(buf_page_get_state(bpage) == state);
}
-/*************************************************************************
+/*********************************************************************//**
Sets the state of a block. */
UNIV_INLINE
void
buf_block_set_state(
/*================*/
- buf_block_t* block, /* in/out: pointer to control block */
- enum buf_page_state state) /* in: state */
+ buf_block_t* block, /*!< in/out: pointer to control block */
+ enum buf_page_state state) /*!< in: state */
{
buf_page_set_state(&block->page, state);
}
-/*************************************************************************
-Determines if a block is mapped to a tablespace. */
+/*********************************************************************//**
+Determines if a block is mapped to a tablespace.
+@return TRUE if mapped */
UNIV_INLINE
ibool
buf_page_in_file(
/*=============*/
- /* out: TRUE if mapped */
- const buf_page_t* bpage) /* in: pointer to control block */
+ const buf_page_t* bpage) /*!< in: pointer to control block */
{
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
@@ -270,15 +271,15 @@ buf_page_in_file(
return(FALSE);
}
-/*************************************************************************
-Determines if a block should be on unzip_LRU list. */
+#ifndef UNIV_HOTBACKUP
+/*********************************************************************//**
+Determines if a block should be on unzip_LRU list.
+@return TRUE if block belongs to unzip_LRU */
UNIV_INLINE
ibool
buf_page_belongs_to_unzip_LRU(
/*==========================*/
- /* out: TRUE if block belongs
- to unzip_LRU */
- const buf_page_t* bpage) /* in: pointer to control block */
+ const buf_page_t* bpage) /*!< in: pointer to control block */
{
ut_ad(buf_page_in_file(bpage));
@@ -286,14 +287,14 @@ buf_page_belongs_to_unzip_LRU(
&& buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
}
-/*************************************************************************
-Determine the approximate LRU list position of a block. */
+/*********************************************************************//**
+Determine the approximate LRU list position of a block.
+@return LRU list position */
UNIV_INLINE
ulint
buf_page_get_LRU_position(
/*======================*/
- /* out: LRU list position */
- const buf_page_t* bpage) /* in: control block */
+ const buf_page_t* bpage) /*!< in: control block */
{
ut_ad(buf_page_in_file(bpage));
//ut_ad(buf_pool_mutex_own()); /* This is used in optimistic */
@@ -301,15 +302,14 @@ buf_page_get_LRU_position(
return(bpage->LRU_position);
}
-/*************************************************************************
-Gets the mutex of a block. */
+/*********************************************************************//**
+Gets the mutex of a block.
+@return pointer to mutex protecting bpage */
UNIV_INLINE
mutex_t*
buf_page_get_mutex(
/*===============*/
- /* out: pointer to mutex
- protecting bpage */
- const buf_page_t* bpage) /* in: pointer to control block */
+ const buf_page_t* bpage) /*!< in: pointer to control block */
{
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
@@ -324,13 +324,35 @@ buf_page_get_mutex(
}
/*************************************************************************
-Get the flush type of a page. */
+Gets the mutex of a block and enter the mutex with consistency. */
+UNIV_INLINE
+mutex_t*
+buf_page_get_mutex_enter(
+/*=========================*/
+ const buf_page_t* bpage) /*!< in: pointer to control block */
+{
+ mutex_t* block_mutex;
+
+ while(1) {
+ block_mutex = buf_page_get_mutex(bpage);
+ if (!block_mutex)
+ return block_mutex;
+
+ mutex_enter(block_mutex);
+ if (block_mutex == buf_page_get_mutex(bpage))
+ return block_mutex;
+ mutex_exit(block_mutex);
+ }
+}
+
+/*********************************************************************//**
+Get the flush type of a page.
+@return flush type */
UNIV_INLINE
enum buf_flush
buf_page_get_flush_type(
/*====================*/
- /* out: flush type */
- const buf_page_t* bpage) /* in: buffer page */
+ const buf_page_t* bpage) /*!< in: buffer page */
{
enum buf_flush flush_type = (enum buf_flush) bpage->flush_type;
@@ -347,42 +369,42 @@ buf_page_get_flush_type(
#endif /* UNIV_DEBUG */
return(flush_type);
}
-/*************************************************************************
+/*********************************************************************//**
Set the flush type of a page. */
UNIV_INLINE
void
buf_page_set_flush_type(
/*====================*/
- buf_page_t* bpage, /* in: buffer page */
- enum buf_flush flush_type) /* in: flush type */
+ buf_page_t* bpage, /*!< in: buffer page */
+ enum buf_flush flush_type) /*!< in: flush type */
{
bpage->flush_type = flush_type;
ut_ad(buf_page_get_flush_type(bpage) == flush_type);
}
-/*************************************************************************
+/*********************************************************************//**
Map a block to a file page. */
UNIV_INLINE
void
buf_block_set_file_page(
/*====================*/
- buf_block_t* block, /* in/out: pointer to control block */
- ulint space, /* in: tablespace id */
- ulint page_no)/* in: page number */
+ buf_block_t* block, /*!< in/out: pointer to control block */
+ ulint space, /*!< in: tablespace id */
+ ulint page_no)/*!< in: page number */
{
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
block->page.space = space;
block->page.offset = page_no;
}
-/*************************************************************************
-Gets the io_fix state of a block. */
+/*********************************************************************//**
+Gets the io_fix state of a block.
+@return io_fix state */
UNIV_INLINE
enum buf_io_fix
buf_page_get_io_fix(
/*================*/
- /* out: io_fix state */
- const buf_page_t* bpage) /* in: pointer to the control block */
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
{
enum buf_io_fix io_fix = (enum buf_io_fix) bpage->io_fix;
#ifdef UNIV_DEBUG
@@ -397,26 +419,26 @@ buf_page_get_io_fix(
return(io_fix);
}
-/*************************************************************************
-Gets the io_fix state of a block. */
+/*********************************************************************//**
+Gets the io_fix state of a block.
+@return io_fix state */
UNIV_INLINE
enum buf_io_fix
buf_block_get_io_fix(
/*================*/
- /* out: io_fix state */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
return(buf_page_get_io_fix(&block->page));
}
-/*************************************************************************
+/*********************************************************************//**
Sets the io_fix state of a block. */
UNIV_INLINE
void
buf_page_set_io_fix(
/*================*/
- buf_page_t* bpage, /* in/out: control block */
- enum buf_io_fix io_fix) /* in: io_fix state */
+ buf_page_t* bpage, /*!< in/out: control block */
+ enum buf_io_fix io_fix) /*!< in: io_fix state */
{
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -425,26 +447,26 @@ buf_page_set_io_fix(
ut_ad(buf_page_get_io_fix(bpage) == io_fix);
}
-/*************************************************************************
+/*********************************************************************//**
Sets the io_fix state of a block. */
UNIV_INLINE
void
buf_block_set_io_fix(
/*=================*/
- buf_block_t* block, /* in/out: control block */
- enum buf_io_fix io_fix) /* in: io_fix state */
+ buf_block_t* block, /*!< in/out: control block */
+ enum buf_io_fix io_fix) /*!< in: io_fix state */
{
buf_page_set_io_fix(&block->page, io_fix);
}
-/************************************************************************
+/********************************************************************//**
Determine if a buffer block can be relocated in memory. The block
can be dirty, but it must not be I/O-fixed or bufferfixed. */
UNIV_INLINE
ibool
buf_page_can_relocate(
/*==================*/
- const buf_page_t* bpage) /* control block being relocated */
+ const buf_page_t* bpage) /*!< control block being relocated */
{
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -456,14 +478,14 @@ buf_page_can_relocate(
&& bpage->buf_fix_count == 0);
}
-/*************************************************************************
-Determine if a block has been flagged old. */
+/*********************************************************************//**
+Determine if a block has been flagged old.
+@return TRUE if old */
UNIV_INLINE
ibool
buf_page_is_old(
/*============*/
- /* out: TRUE if old */
- const buf_page_t* bpage) /* in: control block */
+ const buf_page_t* bpage) /*!< in: control block */
{
ut_ad(buf_page_in_file(bpage));
//ut_ad(buf_pool_mutex_own()); /* This is used in optimistic */
@@ -471,14 +493,14 @@ buf_page_is_old(
return(bpage->old);
}
-/*************************************************************************
+/*********************************************************************//**
Flag a block old. */
UNIV_INLINE
void
buf_page_set_old(
/*=============*/
- buf_page_t* bpage, /* in/out: control block */
- ibool old) /* in: old */
+ buf_page_t* bpage, /*!< in/out: control block */
+ ibool old) /*!< in: old */
{
ut_a(buf_page_in_file(bpage));
//ut_ad(buf_pool_mutex_own());
@@ -496,28 +518,28 @@ buf_page_set_old(
bpage->old = old;
}
-/*************************************************************************
-Determine if a block has been accessed in the buffer pool. */
+/*********************************************************************//**
+Determine if a block has been accessed in the buffer pool.
+@return TRUE if accessed */
UNIV_INLINE
ibool
buf_page_is_accessed(
/*=================*/
- /* out: TRUE if accessed */
- const buf_page_t* bpage) /* in: control block */
+ const buf_page_t* bpage) /*!< in: control block */
{
ut_ad(buf_page_in_file(bpage));
return(bpage->accessed);
}
-/*************************************************************************
+/*********************************************************************//**
Flag a block accessed. */
UNIV_INLINE
void
buf_page_set_accessed(
/*==================*/
- buf_page_t* bpage, /* in/out: control block */
- ibool accessed) /* in: accessed */
+ buf_page_t* bpage, /*!< in/out: control block */
+ ibool accessed) /*!< in: accessed */
{
ut_a(buf_page_in_file(bpage));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -525,15 +547,15 @@ buf_page_set_accessed(
bpage->accessed = accessed;
}
-/*************************************************************************
+/*********************************************************************//**
Gets the buf_block_t handle of a buffered file block if an uncompressed
-page frame exists, or NULL. */
+page frame exists, or NULL.
+@return control block, or NULL */
UNIV_INLINE
buf_block_t*
buf_page_get_block(
/*===============*/
- /* out: control block, or NULL */
- buf_page_t* bpage) /* in: control block, or NULL */
+ buf_page_t* bpage) /*!< in: control block, or NULL */
{
if (UNIV_LIKELY(bpage != NULL)) {
ut_ad(buf_page_in_file(bpage));
@@ -545,16 +567,17 @@ buf_page_get_block(
return(NULL);
}
+#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
-/*************************************************************************
-Gets a pointer to the memory frame of a block. */
+/*********************************************************************//**
+Gets a pointer to the memory frame of a block.
+@return pointer to the frame */
UNIV_INLINE
buf_frame_t*
buf_block_get_frame(
/*================*/
- /* out: pointer to the frame */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
ut_ad(block);
@@ -566,7 +589,9 @@ buf_block_get_frame(
ut_error;
break;
case BUF_BLOCK_FILE_PAGE:
+# ifndef UNIV_HOTBACKUP
ut_a(block->page.buf_fix_count > 0);
+# endif /* !UNIV_HOTBACKUP */
/* fall through */
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY:
@@ -579,14 +604,14 @@ ok:
}
#endif /* UNIV_DEBUG */
-/*************************************************************************
-Gets the space id of a block. */
+/*********************************************************************//**
+Gets the space id of a block.
+@return space id */
UNIV_INLINE
ulint
buf_page_get_space(
/*===============*/
- /* out: space id */
- const buf_page_t* bpage) /* in: pointer to the control block */
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
{
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
@@ -594,14 +619,14 @@ buf_page_get_space(
return(bpage->space);
}
-/*************************************************************************
-Gets the space id of a block. */
+/*********************************************************************//**
+Gets the space id of a block.
+@return space id */
UNIV_INLINE
ulint
buf_block_get_space(
/*================*/
- /* out: space id */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
ut_ad(block);
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -609,14 +634,14 @@ buf_block_get_space(
return(block->page.space);
}
-/*************************************************************************
-Gets the page number of a block. */
+/*********************************************************************//**
+Gets the page number of a block.
+@return page number */
UNIV_INLINE
ulint
buf_page_get_page_no(
/*=================*/
- /* out: page number */
- const buf_page_t* bpage) /* in: pointer to the control block */
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
{
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
@@ -624,14 +649,14 @@ buf_page_get_page_no(
return(bpage->offset);
}
-/*************************************************************************
-Gets the page number of a block. */
+/*********************************************************************//**
+Gets the page number of a block.
+@return page number */
UNIV_INLINE
ulint
buf_block_get_page_no(
/*==================*/
- /* out: page number */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
ut_ad(block);
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -639,55 +664,57 @@ buf_block_get_page_no(
return(block->page.offset);
}
-/*************************************************************************
-Gets the compressed page size of a block. */
+/*********************************************************************//**
+Gets the compressed page size of a block.
+@return compressed page size, or 0 */
UNIV_INLINE
ulint
buf_page_get_zip_size(
/*==================*/
- /* out: compressed page size, or 0 */
- const buf_page_t* bpage) /* in: pointer to the control block */
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
{
return(bpage->zip.ssize ? 512 << bpage->zip.ssize : 0);
}
-/*************************************************************************
-Gets the compressed page size of a block. */
+/*********************************************************************//**
+Gets the compressed page size of a block.
+@return compressed page size, or 0 */
UNIV_INLINE
ulint
buf_block_get_zip_size(
/*===================*/
- /* out: compressed page size, or 0 */
- const buf_block_t* block) /* in: pointer to the control block */
+ const buf_block_t* block) /*!< in: pointer to the control block */
{
return(block->page.zip.ssize ? 512 << block->page.zip.ssize : 0);
}
+#ifndef UNIV_HOTBACKUP
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
-/*************************************************************************
+/*********************************************************************//**
Gets the compressed page descriptor corresponding to an uncompressed page
-if applicable. */
+if applicable.
+@return compressed page descriptor, or NULL */
UNIV_INLINE
const page_zip_des_t*
buf_frame_get_page_zip(
/*===================*/
- /* out: compressed page descriptor, or NULL */
- const byte* ptr) /* in: pointer to the page */
+ const byte* ptr) /*!< in: pointer to the page */
{
return(buf_block_get_page_zip(buf_block_align(ptr)));
}
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
+#endif /* !UNIV_HOTBACKUP */
-/**************************************************************************
+/**********************************************************************//**
Gets the space id, page offset, and byte offset within page of a
pointer pointing to a buffer frame containing a file page. */
UNIV_INLINE
void
buf_ptr_get_fsp_addr(
/*=================*/
- const void* ptr, /* in: pointer to a buffer frame */
- ulint* space, /* out: space id */
- fil_addr_t* addr) /* out: page offset and byte offset */
+ const void* ptr, /*!< in: pointer to a buffer frame */
+ ulint* space, /*!< out: space id */
+ fil_addr_t* addr) /*!< out: page offset and byte offset */
{
const page_t* page = (const page_t*) ut_align_down(ptr,
UNIV_PAGE_SIZE);
@@ -697,28 +724,28 @@ buf_ptr_get_fsp_addr(
addr->boffset = ut_align_offset(ptr, UNIV_PAGE_SIZE);
}
-/**************************************************************************
+#ifndef UNIV_HOTBACKUP
+/**********************************************************************//**
Gets the hash value of the page the pointer is pointing to. This can be used
-in searches in the lock hash table. */
+in searches in the lock hash table.
+@return lock hash value */
UNIV_INLINE
ulint
buf_block_get_lock_hash_val(
/*========================*/
- /* out: lock hash value */
- const buf_block_t* block) /* in: block */
+ const buf_block_t* block) /*!< in: block */
{
return(block->lock_hash_val);
}
-/************************************************************************
-Allocates a buffer block. */
+/********************************************************************//**
+Allocates a buffer block.
+@return own: the allocated block, in state BUF_BLOCK_MEMORY */
UNIV_INLINE
buf_block_t*
buf_block_alloc(
/*============*/
- /* out, own: the allocated block,
- in state BUF_BLOCK_MEMORY */
- ulint zip_size) /* in: compressed page size in bytes,
+ ulint zip_size) /*!< in: compressed page size in bytes,
or 0 if uncompressed tablespace */
{
buf_block_t* block;
@@ -730,13 +757,13 @@ buf_block_alloc(
return(block);
}
-/************************************************************************
+/********************************************************************//**
Frees a buffer block which does not contain a file page. */
UNIV_INLINE
void
buf_block_free(
/*===========*/
- buf_block_t* block) /* in, own: block to be freed */
+ buf_block_t* block) /*!< in, own: block to be freed */
{
//buf_pool_mutex_enter();
@@ -750,16 +777,17 @@ buf_block_free(
//buf_pool_mutex_exit();
}
+#endif /* !UNIV_HOTBACKUP */
-/*************************************************************************
-Copies contents of a buffer frame to a given buffer. */
+/*********************************************************************//**
+Copies contents of a buffer frame to a given buffer.
+@return buf */
UNIV_INLINE
byte*
buf_frame_copy(
/*===========*/
- /* out: buf */
- byte* buf, /* in: buffer to copy to */
- const buf_frame_t* frame) /* in: buffer frame */
+ byte* buf, /*!< in: buffer to copy to */
+ const buf_frame_t* frame) /*!< in: buffer frame */
{
ut_ad(buf && frame);
@@ -768,73 +796,36 @@ buf_frame_copy(
return(buf);
}
-/************************************************************************
+#ifndef UNIV_HOTBACKUP
+/********************************************************************//**
Calculates a folded value of a file page address to use in the page hash
-table. */
+table.
+@return the folded value */
UNIV_INLINE
ulint
buf_page_address_fold(
/*==================*/
- /* out: the folded value */
- ulint space, /* in: space id */
- ulint offset) /* in: offset of the page within space */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page within space */
{
return((space << 20) + space + offset);
}
-/************************************************************************
-This function is used to get info if there is an io operation
-going on on a buffer page. */
-UNIV_INLINE
-ibool
-buf_page_io_query(
-/*==============*/
- /* out: TRUE if io going on */
- buf_page_t* bpage) /* in: buf_pool block, must be bufferfixed */
-{
- ibool io_fixed;
- mutex_t* block_mutex = buf_page_get_mutex(bpage);
-
- //buf_pool_mutex_enter();
-retry_lock:
- mutex_enter(block_mutex);
- if (block_mutex != buf_page_get_mutex(bpage)) {
- mutex_exit(block_mutex);
- block_mutex = buf_page_get_mutex(bpage);
- goto retry_lock;
- }
-
- ut_ad(buf_page_in_file(bpage));
- ut_ad(bpage->buf_fix_count > 0);
-
- io_fixed = buf_page_get_io_fix(bpage) != BUF_IO_NONE;
- //buf_pool_mutex_exit();
- mutex_exit(block_mutex);
-
- return(io_fixed);
-}
-
-/************************************************************************
+/********************************************************************//**
Gets the youngest modification log sequence number for a frame.
-Returns zero if not file page or no modification occurred yet. */
+Returns zero if not file page or no modification occurred yet.
+@return newest modification to page */
UNIV_INLINE
ib_uint64_t
buf_page_get_newest_modification(
/*=============================*/
- /* out: newest modification to page */
- const buf_page_t* bpage) /* in: block containing the
+ const buf_page_t* bpage) /*!< in: block containing the
page frame */
{
ib_uint64_t lsn;
- mutex_t* block_mutex = buf_page_get_mutex(bpage);
+ mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
-retry_lock:
- mutex_enter(block_mutex);
- if (block_mutex != buf_page_get_mutex(bpage)) {
- mutex_exit(block_mutex);
- block_mutex = buf_page_get_mutex(bpage);
- goto retry_lock;
- }
+ ut_a(block_mutex);
if (buf_page_in_file(bpage)) {
lsn = bpage->newest_modification;
@@ -847,7 +838,7 @@ retry_lock:
return(lsn);
}
-/************************************************************************
+/********************************************************************//**
Increments the modify clock of a frame by 1. The caller must (1) own the
buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */
@@ -855,7 +846,7 @@ UNIV_INLINE
void
buf_block_modify_clock_inc(
/*=======================*/
- buf_block_t* block) /* in: block */
+ buf_block_t* block) /*!< in: block */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&LRU_list_mutex)
@@ -866,15 +857,15 @@ buf_block_modify_clock_inc(
block->modify_clock++;
}
-/************************************************************************
+/********************************************************************//**
Returns the value of the modify clock. The caller must have an s-lock
-or x-lock on the block. */
+or x-lock on the block.
+@return value */
UNIV_INLINE
ib_uint64_t
buf_block_get_modify_clock(
/*=======================*/
- /* out: value */
- buf_block_t* block) /* in: block */
+ buf_block_t* block) /*!< in: block */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
@@ -884,17 +875,17 @@ buf_block_get_modify_clock(
return(block->modify_clock);
}
-/***********************************************************************
+/*******************************************************************//**
Increments the bufferfix count. */
UNIV_INLINE
void
buf_block_buf_fix_inc_func(
/*=======================*/
#ifdef UNIV_SYNC_DEBUG
- const char* file, /* in: file name */
- ulint line, /* in: line */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line */
#endif /* UNIV_SYNC_DEBUG */
- buf_block_t* block) /* in: block to bufferfix */
+ buf_block_t* block) /*!< in/out: block to bufferfix */
{
#ifdef UNIV_SYNC_DEBUG
ibool ret;
@@ -907,18 +898,26 @@ buf_block_buf_fix_inc_func(
block->page.buf_fix_count++;
}
#ifdef UNIV_SYNC_DEBUG
+/** Increments the bufferfix count.
+@param b in/out: block to bufferfix
+@param f in: file name where requested
+@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
#else /* UNIV_SYNC_DEBUG */
+/** Increments the bufferfix count.
+@param b in/out: block to bufferfix
+@param f in: file name where requested
+@param l in: line number where requested */
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
#endif /* UNIV_SYNC_DEBUG */
-/***********************************************************************
+/*******************************************************************//**
Decrements the bufferfix count. */
UNIV_INLINE
void
buf_block_buf_fix_dec(
/*==================*/
- buf_block_t* block) /* in: block to bufferunfix */
+ buf_block_t* block) /*!< in/out: block to bufferunfix */
{
ut_ad(mutex_own(&block->mutex));
@@ -928,15 +927,15 @@ buf_block_buf_fix_dec(
#endif
}
-/**********************************************************************
-Returns the control block of a file page, NULL if not found. */
+/******************************************************************//**
+Returns the control block of a file page, NULL if not found.
+@return block, NULL if not found */
UNIV_INLINE
buf_page_t*
buf_page_hash_get(
/*==============*/
- /* out: block, NULL if not found */
- ulint space, /* in: space id */
- ulint offset) /* in: offset of the page within space */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page within space */
{
buf_page_t* bpage;
ulint fold;
@@ -966,32 +965,33 @@ buf_page_hash_get(
return(bpage);
}
-/**********************************************************************
+/******************************************************************//**
Returns the control block of a file page, NULL if not found
-or an uncompressed page frame does not exist. */
+or an uncompressed page frame does not exist.
+@return block, NULL if not found */
UNIV_INLINE
buf_block_t*
buf_block_hash_get(
/*===============*/
- /* out: block, NULL if not found */
- ulint space, /* in: space id */
- ulint offset) /* in: offset of the page within space */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: offset of the page within space */
{
return(buf_page_get_block(buf_page_hash_get(space, offset)));
}
-/************************************************************************
-Returns TRUE if the page can be found in the buffer pool hash table. NOTE
-that it is possible that the page is not yet read from disk, though. */
+/********************************************************************//**
+Returns TRUE if the page can be found in the buffer pool hash table.
+
+NOTE that it is possible that the page is not yet read from disk,
+though.
+
+@return TRUE if found in the page hash table */
UNIV_INLINE
ibool
buf_page_peek(
/*==========*/
- /* out: TRUE if found from page hash table,
- NOTE that the page is not necessarily yet read
- from disk! */
- ulint space, /* in: space id */
- ulint offset) /* in: page number */
+ ulint space, /*!< in: space id */
+ ulint offset) /*!< in: page number */
{
const buf_page_t* bpage;
@@ -1006,13 +1006,13 @@ buf_page_peek(
return(bpage != NULL);
}
-/************************************************************************
+/********************************************************************//**
Releases a compressed-only page acquired with buf_page_get_zip(). */
UNIV_INLINE
void
buf_page_release_zip(
/*=================*/
- buf_page_t* bpage) /* in: buffer block */
+ buf_page_t* bpage) /*!< in: buffer block */
{
buf_block_t* block;
@@ -1046,17 +1046,17 @@ buf_page_release_zip(
ut_error;
}
-/************************************************************************
+/********************************************************************//**
Decrements the bufferfix count of a buffer control block and releases
a latch, if specified. */
UNIV_INLINE
void
buf_page_release(
/*=============*/
- buf_block_t* block, /* in: buffer block */
- ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH,
+ buf_block_t* block, /*!< in: buffer block */
+ ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH,
RW_NO_LATCH */
- mtr_t* mtr __attribute__((unused))) /* in: mtr */
+ mtr_t* mtr __attribute__((unused))) /*!< in: mtr */
{
ut_ad(block);
@@ -1079,10 +1079,6 @@ 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) {
@@ -1093,7 +1089,7 @@ buf_page_release(
}
#ifdef UNIV_SYNC_DEBUG
-/*************************************************************************
+/*********************************************************************//**
Adds latch level info for the rw-lock protecting the buffer frame. This
should be called in the debug version after a successful latching of a
page if we know the latching order level of the acquired latch. */
@@ -1101,10 +1097,11 @@ UNIV_INLINE
void
buf_block_dbg_add_level(
/*====================*/
- buf_block_t* block, /* in: buffer page
+ buf_block_t* block, /*!< in: buffer page
where we have acquired latch */
- ulint level) /* in: latching order level */
+ ulint level) /*!< in: latching order level */
{
sync_thread_add_level(&block->lock, level);
}
#endif /* UNIV_SYNC_DEBUG */
+#endif /* !UNIV_HOTBACKUP */