summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/page0page.ic
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-03-20 15:01:47 +0300
committerSergey Petrunya <psergey@askmonty.org>2010-03-20 15:01:47 +0300
commit7df026676b6d845cc0ed7a7437995c3019a5f42d (patch)
treedc051ac4712ac159b52fc2b48e5dd918cbc39799 /storage/xtradb/include/page0page.ic
parentf59d1dcf0acc12c482c28c902a0030f12ba263af (diff)
parentf09ca00e088b316441bb76e97ba097bc9f3da7d3 (diff)
downloadmariadb-git-7df026676b6d845cc0ed7a7437995c3019a5f42d.tar.gz
Merge MariaDB-5.2 -> MariaDB 5.3
Diffstat (limited to 'storage/xtradb/include/page0page.ic')
-rw-r--r--storage/xtradb/include/page0page.ic455
1 files changed, 234 insertions, 221 deletions
diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic
index df0f6f8b360..8f794410f20 100644
--- a/storage/xtradb/include/page0page.ic
+++ b/storage/xtradb/include/page0page.ic
@@ -16,14 +16,20 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************
+/**************************************************//**
+@file include/page0page.ic
Index page routines
Created 2/2/1994 Heikki Tuuri
*******************************************************/
#include "mach0data.h"
-#include "rem0cmp.h"
+#ifdef UNIV_DEBUG
+# include "log0recv.h"
+#endif /* !UNIV_DEBUG */
+#ifndef UNIV_HOTBACKUP
+# include "rem0cmp.h"
+#endif /* !UNIV_HOTBACKUP */
#include "mtr0log.h"
#include "page0zip.h"
@@ -32,70 +38,80 @@ Created 2/2/1994 Heikki Tuuri
#define UNIV_INLINE
#endif
-/****************************************************************
-Gets the start of a page. */
+/************************************************************//**
+Gets the start of a page.
+@return start of the page */
UNIV_INLINE
page_t*
page_align(
/*=======*/
- /* out: start of the page */
- const void* ptr) /* in: pointer to page frame */
+ const void* ptr) /*!< in: pointer to page frame */
{
return((page_t*) ut_align_down(ptr, UNIV_PAGE_SIZE));
}
-/****************************************************************
-Gets the offset within a page. */
+/************************************************************//**
+Gets the offset within a page.
+@return offset from the start of the page */
UNIV_INLINE
ulint
page_offset(
/*========*/
- /* out: offset from the start of the page */
- const void* ptr) /* in: pointer to page frame */
+ const void* ptr) /*!< in: pointer to page frame */
{
return(ut_align_offset(ptr, UNIV_PAGE_SIZE));
}
-/*****************************************************************
+/*************************************************************//**
Returns the max trx id field value. */
UNIV_INLINE
-dulint
+trx_id_t
page_get_max_trx_id(
/*================*/
- const page_t* page) /* in: page */
+ const page_t* page) /*!< in: page */
{
ut_ad(page);
return(mach_read_from_8(page + PAGE_HEADER + PAGE_MAX_TRX_ID));
}
-/*****************************************************************
+/*************************************************************//**
Sets the max trx id field value if trx_id is bigger than the previous
value. */
UNIV_INLINE
void
page_update_max_trx_id(
/*===================*/
- buf_block_t* block, /* in/out: page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ buf_block_t* block, /*!< in/out: page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
- dulint trx_id) /* in: transaction id */
+ trx_id_t trx_id, /*!< in: transaction id */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
ut_ad(block);
+ ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+ /* During crash recovery, this function may be called on
+ something else than a leaf page of a secondary index or the
+ insert buffer index tree (dict_index_is_sec_or_ibuf() returns
+ TRUE for the dummy indexes constructed during redo log
+ application). In that case, PAGE_MAX_TRX_ID is unused,
+ and trx_id is usually zero. */
+ ut_ad(!ut_dulint_is_zero(trx_id) || recv_recovery_is_on());
+ ut_ad(page_is_leaf(buf_block_get_frame(block)));
if (ut_dulint_cmp(page_get_max_trx_id(buf_block_get_frame(block)),
trx_id) < 0) {
- page_set_max_trx_id(block, page_zip, trx_id);
+ page_set_max_trx_id(block, page_zip, trx_id, mtr);
}
}
-/*****************************************************************
+/*************************************************************//**
Reads the given header field. */
UNIV_INLINE
ulint
page_header_get_field(
/*==================*/
- const page_t* page, /* in: page */
- ulint field) /* in: PAGE_LEVEL, ... */
+ const page_t* page, /*!< in: page */
+ ulint field) /*!< in: PAGE_LEVEL, ... */
{
ut_ad(page);
ut_ad(field <= PAGE_INDEX_ID);
@@ -103,17 +119,17 @@ page_header_get_field(
return(mach_read_from_2(page + PAGE_HEADER + field));
}
-/*****************************************************************
+/*************************************************************//**
Sets the given header field. */
UNIV_INLINE
void
page_header_set_field(
/*==================*/
- page_t* page, /* in/out: page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ page_t* page, /*!< in/out: page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
- ulint field, /* in: PAGE_N_DIR_SLOTS, ... */
- ulint val) /* in: value */
+ ulint field, /*!< in: PAGE_N_DIR_SLOTS, ... */
+ ulint val) /*!< in: value */
{
ut_ad(page);
ut_ad(field <= PAGE_N_RECS);
@@ -127,16 +143,15 @@ page_header_set_field(
}
}
-/*****************************************************************
-Returns the offset stored in the given header field. */
+/*************************************************************//**
+Returns the offset stored in the given header field.
+@return offset from the start of the page, or 0 */
UNIV_INLINE
ulint
page_header_get_offs(
/*=================*/
- /* out: offset from the start of the page,
- or 0 */
- const page_t* page, /* in: page */
- ulint field) /* in: PAGE_FREE, ... */
+ const page_t* page, /*!< in: page */
+ ulint field) /*!< in: PAGE_FREE, ... */
{
ulint offs;
@@ -152,17 +167,17 @@ page_header_get_offs(
return(offs);
}
-/*****************************************************************
+/*************************************************************//**
Sets the pointer stored in the given header field. */
UNIV_INLINE
void
page_header_set_ptr(
/*================*/
- page_t* page, /* in: page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ page_t* page, /*!< in: page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
- ulint field, /* in: PAGE_FREE, ... */
- const byte* ptr) /* in: pointer or NULL*/
+ ulint field, /*!< in: PAGE_FREE, ... */
+ const byte* ptr) /*!< in: pointer or NULL*/
{
ulint offs;
@@ -182,17 +197,18 @@ page_header_set_ptr(
page_header_set_field(page, page_zip, field, offs);
}
-/*****************************************************************
+#ifndef UNIV_HOTBACKUP
+/*************************************************************//**
Resets the last insert info field in the page header. Writes to mlog
about this operation. */
UNIV_INLINE
void
page_header_reset_last_insert(
/*==========================*/
- page_t* page, /* in/out: page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ page_t* page, /*!< in/out: page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
- mtr_t* mtr) /* in: mtr */
+ mtr_t* mtr) /*!< in: mtr */
{
ut_ad(page && mtr);
@@ -206,41 +222,42 @@ page_header_reset_last_insert(
MLOG_2BYTES, mtr);
}
}
+#endif /* !UNIV_HOTBACKUP */
-/****************************************************************
-Determine whether the page is in new-style compact format. */
+/************************************************************//**
+Determine whether the page is in new-style compact format.
+@return nonzero if the page is in compact format, zero if it is in
+old-style format */
UNIV_INLINE
ulint
page_is_comp(
/*=========*/
- /* out: nonzero if the page is in compact
- format, zero if it is in old-style format */
- const page_t* page) /* in: index page */
+ const page_t* page) /*!< in: index page */
{
return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000,
0x8000));
}
-/****************************************************************
-TRUE if the record is on a page in compact format. */
+/************************************************************//**
+TRUE if the record is on a page in compact format.
+@return nonzero if in compact format */
UNIV_INLINE
ulint
page_rec_is_comp(
/*=============*/
- /* out: nonzero if in compact format */
- const rec_t* rec) /* in: record */
+ const rec_t* rec) /*!< in: record */
{
return(page_is_comp(page_align(rec)));
}
-/*******************************************************************
-Returns the heap number of a record. */
+/***************************************************************//**
+Returns the heap number of a record.
+@return heap number */
UNIV_INLINE
ulint
page_rec_get_heap_no(
/*=================*/
- /* out: heap number */
- const rec_t* rec) /* in: the physical record */
+ const rec_t* rec) /*!< in: the physical record */
{
if (page_rec_is_comp(rec)) {
return(rec_get_heap_no_new(rec));
@@ -249,27 +266,26 @@ page_rec_get_heap_no(
}
}
-/****************************************************************
-Determine whether the page is a B-tree leaf. */
+/************************************************************//**
+Determine whether the page is a B-tree leaf.
+@return TRUE if the page is a B-tree leaf */
UNIV_INLINE
ibool
page_is_leaf(
/*=========*/
- /* out: TRUE if the page is a B-tree leaf */
- const page_t* page) /* in: page */
+ const page_t* page) /*!< in: page */
{
return(!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL)));
}
-/****************************************************************
-Gets the offset of the first record on the page. */
+/************************************************************//**
+Gets the offset of the first record on the page.
+@return offset of the first record in record list, relative from page */
UNIV_INLINE
ulint
page_get_infimum_offset(
/*====================*/
- /* out: offset of the first record
- in record list, relative from page */
- const page_t* page) /* in: page which must have record(s) */
+ const page_t* page) /*!< in: page which must have record(s) */
{
ut_ad(page);
ut_ad(!page_offset(page));
@@ -281,15 +297,14 @@ page_get_infimum_offset(
}
}
-/****************************************************************
-Gets the offset of the last record on the page. */
+/************************************************************//**
+Gets the offset of the last record on the page.
+@return offset of the last record in record list, relative from page */
UNIV_INLINE
ulint
page_get_supremum_offset(
/*=====================*/
- /* out: offset of the last record in
- record list, relative from page */
- const page_t* page) /* in: page which must have record(s) */
+ const page_t* page) /*!< in: page which must have record(s) */
{
ut_ad(page);
ut_ad(!page_offset(page));
@@ -301,14 +316,14 @@ page_get_supremum_offset(
}
}
-/****************************************************************
-TRUE if the record is a user record on the page. */
+/************************************************************//**
+TRUE if the record is a user record on the page.
+@return TRUE if a user record */
UNIV_INLINE
ibool
page_rec_is_user_rec_low(
/*=====================*/
- /* out: TRUE if a user record */
- ulint offset) /* in: record offset on page */
+ ulint offset) /*!< in: record offset on page */
{
ut_ad(offset >= PAGE_NEW_INFIMUM);
#if PAGE_OLD_INFIMUM < PAGE_NEW_INFIMUM
@@ -337,14 +352,14 @@ page_rec_is_user_rec_low(
&& UNIV_LIKELY(offset != PAGE_OLD_SUPREMUM));
}
-/****************************************************************
-TRUE if the record is the supremum record on a page. */
+/************************************************************//**
+TRUE if the record is the supremum record on a page.
+@return TRUE if the supremum record */
UNIV_INLINE
ibool
page_rec_is_supremum_low(
/*=====================*/
- /* out: TRUE if the supremum record */
- ulint offset) /* in: record offset on page */
+ ulint offset) /*!< in: record offset on page */
{
ut_ad(offset >= PAGE_NEW_INFIMUM);
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
@@ -353,14 +368,14 @@ page_rec_is_supremum_low(
|| UNIV_UNLIKELY(offset == PAGE_OLD_SUPREMUM));
}
-/****************************************************************
-TRUE if the record is the infimum record on a page. */
+/************************************************************//**
+TRUE if the record is the infimum record on a page.
+@return TRUE if the infimum record */
UNIV_INLINE
ibool
page_rec_is_infimum_low(
/*====================*/
- /* out: TRUE if the infimum record */
- ulint offset) /* in: record offset on page */
+ ulint offset) /*!< in: record offset on page */
{
ut_ad(offset >= PAGE_NEW_INFIMUM);
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
@@ -369,65 +384,65 @@ page_rec_is_infimum_low(
|| UNIV_UNLIKELY(offset == PAGE_OLD_INFIMUM));
}
-/****************************************************************
-TRUE if the record is a user record on the page. */
+/************************************************************//**
+TRUE if the record is a user record on the page.
+@return TRUE if a user record */
UNIV_INLINE
ibool
page_rec_is_user_rec(
/*=================*/
- /* out: TRUE if a user record */
- const rec_t* rec) /* in: record */
+ const rec_t* rec) /*!< in: record */
{
return(page_rec_is_user_rec_low(page_offset(rec)));
}
-/****************************************************************
-TRUE if the record is the supremum record on a page. */
+/************************************************************//**
+TRUE if the record is the supremum record on a page.
+@return TRUE if the supremum record */
UNIV_INLINE
ibool
page_rec_is_supremum(
/*=================*/
- /* out: TRUE if the supremum record */
- const rec_t* rec) /* in: record */
+ const rec_t* rec) /*!< in: record */
{
return(page_rec_is_supremum_low(page_offset(rec)));
}
-/****************************************************************
-TRUE if the record is the infimum record on a page. */
+/************************************************************//**
+TRUE if the record is the infimum record on a page.
+@return TRUE if the infimum record */
UNIV_INLINE
ibool
page_rec_is_infimum(
/*================*/
- /* out: TRUE if the infimum record */
- const rec_t* rec) /* in: record */
+ const rec_t* rec) /*!< in: record */
{
return(page_rec_is_infimum_low(page_offset(rec)));
}
-/*****************************************************************
+#ifndef UNIV_HOTBACKUP
+/*************************************************************//**
Compares a data tuple to a physical record. Differs from the function
cmp_dtuple_rec_with_match in the way that the record must reside on an
index page, and also page infimum and supremum records can be given in
the parameter rec. These are considered as the negative infinity and
-the positive infinity in the alphabetical order. */
+the positive infinity in the alphabetical order.
+@return 1, 0, -1, if dtuple is greater, equal, less than rec,
+respectively, when only the common first fields are compared */
UNIV_INLINE
int
page_cmp_dtuple_rec_with_match(
/*===========================*/
- /* out: 1, 0, -1, if dtuple is greater, equal,
- less than rec, respectively, when only the
- common first fields are compared */
- const dtuple_t* dtuple, /* in: data tuple */
- const rec_t* rec, /* in: physical record on a page; may also
+ const dtuple_t* dtuple, /*!< in: data tuple */
+ const rec_t* rec, /*!< in: physical record on a page; may also
be page infimum or supremum, in which case
matched-parameter values below are not
affected */
- const ulint* offsets,/* in: array returned by rec_get_offsets() */
- ulint* matched_fields, /* in/out: number of already completely
+ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ ulint* matched_fields, /*!< in/out: number of already completely
matched fields; when function returns
contains the value for current comparison */
- ulint* matched_bytes) /* in/out: number of already matched
+ ulint* matched_bytes) /*!< in/out: number of already matched
bytes within the first field not completely
matched; when function returns contains the
value for current comparison */
@@ -453,96 +468,97 @@ page_cmp_dtuple_rec_with_match(
matched_fields,
matched_bytes));
}
+#endif /* !UNIV_HOTBACKUP */
-/*****************************************************************
-Gets the page number. */
+/*************************************************************//**
+Gets the page number.
+@return page number */
UNIV_INLINE
ulint
page_get_page_no(
/*=============*/
- /* out: page number */
- const page_t* page) /* in: page */
+ const page_t* page) /*!< in: page */
{
ut_ad(page == page_align((page_t*) page));
return(mach_read_from_4(page + FIL_PAGE_OFFSET));
}
-/*****************************************************************
-Gets the tablespace identifier. */
+/*************************************************************//**
+Gets the tablespace identifier.
+@return space id */
UNIV_INLINE
ulint
page_get_space_id(
/*==============*/
- /* out: space id */
- const page_t* page) /* in: page */
+ const page_t* page) /*!< in: page */
{
ut_ad(page == page_align((page_t*) page));
return(mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
}
-/*****************************************************************
+/*************************************************************//**
Gets the number of user records on page (infimum and supremum records
-are not user records). */
+are not user records).
+@return number of user records */
UNIV_INLINE
ulint
page_get_n_recs(
/*============*/
- /* out: number of user records */
- const page_t* page) /* in: index page */
+ const page_t* page) /*!< in: index page */
{
return(page_header_get_field(page, PAGE_N_RECS));
}
-/*****************************************************************
-Gets the number of dir slots in directory. */
+/*************************************************************//**
+Gets the number of dir slots in directory.
+@return number of slots */
UNIV_INLINE
ulint
page_dir_get_n_slots(
/*=================*/
- /* out: number of slots */
- const page_t* page) /* in: index page */
+ const page_t* page) /*!< in: index page */
{
return(page_header_get_field(page, PAGE_N_DIR_SLOTS));
}
-/*****************************************************************
+/*************************************************************//**
Sets the number of dir slots in directory. */
UNIV_INLINE
void
page_dir_set_n_slots(
/*=================*/
- page_t* page, /* in/out: page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ page_t* page, /*!< in/out: page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
- ulint n_slots)/* in: number of slots */
+ ulint n_slots)/*!< in: number of slots */
{
page_header_set_field(page, page_zip, PAGE_N_DIR_SLOTS, n_slots);
}
-/*****************************************************************
-Gets the number of records in the heap. */
+/*************************************************************//**
+Gets the number of records in the heap.
+@return number of user records */
UNIV_INLINE
ulint
page_dir_get_n_heap(
/*================*/
- /* out: number of user records */
- const page_t* page) /* in: index page */
+ const page_t* page) /*!< in: index page */
{
return(page_header_get_field(page, PAGE_N_HEAP) & 0x7fff);
}
-/*****************************************************************
+/*************************************************************//**
Sets the number of records in the heap. */
UNIV_INLINE
void
page_dir_set_n_heap(
/*================*/
- page_t* page, /* in/out: index page */
- page_zip_des_t* page_zip,/* in/out: compressed page whose
+ page_t* page, /*!< in/out: index page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL.
Note that the size of the dense page directory
in the compressed page trailer is
n_heap * PAGE_ZIP_DIR_SLOT_SIZE. */
- ulint n_heap) /* in: number of records */
+ ulint n_heap) /*!< in: number of records */
{
ut_ad(n_heap < 0x8000);
ut_ad(!page_zip || n_heap
@@ -554,15 +570,15 @@ page_dir_set_n_heap(
}
#ifdef UNIV_DEBUG
-/*****************************************************************
-Gets pointer to nth directory slot. */
+/*************************************************************//**
+Gets pointer to nth directory slot.
+@return pointer to dir slot */
UNIV_INLINE
page_dir_slot_t*
page_dir_get_nth_slot(
/*==================*/
- /* out: pointer to dir slot */
- const page_t* page, /* in: index page */
- ulint n) /* in: position */
+ const page_t* page, /*!< in: index page */
+ ulint n) /*!< in: position */
{
ut_ad(page_dir_get_n_slots(page) > n);
@@ -572,14 +588,14 @@ page_dir_get_nth_slot(
}
#endif /* UNIV_DEBUG */
-/******************************************************************
-Used to check the consistency of a record on a page. */
+/**************************************************************//**
+Used to check the consistency of a record on a page.
+@return TRUE if succeed */
UNIV_INLINE
ibool
page_rec_check(
/*===========*/
- /* out: TRUE if succeed */
- const rec_t* rec) /* in: record */
+ const rec_t* rec) /*!< in: record */
{
const page_t* page = page_align(rec);
@@ -591,40 +607,40 @@ page_rec_check(
return(TRUE);
}
-/*******************************************************************
-Gets the record pointed to by a directory slot. */
+/***************************************************************//**
+Gets the record pointed to by a directory slot.
+@return pointer to record */
UNIV_INLINE
const rec_t*
page_dir_slot_get_rec(
/*==================*/
- /* out: pointer to record */
- const page_dir_slot_t* slot) /* in: directory slot */
+ const page_dir_slot_t* slot) /*!< in: directory slot */
{
return(page_align(slot) + mach_read_from_2(slot));
}
-/*******************************************************************
+/***************************************************************//**
This is used to set the record offset in a directory slot. */
UNIV_INLINE
void
page_dir_slot_set_rec(
/*==================*/
- page_dir_slot_t* slot, /* in: directory slot */
- rec_t* rec) /* in: record on the page */
+ page_dir_slot_t* slot, /*!< in: directory slot */
+ rec_t* rec) /*!< in: record on the page */
{
ut_ad(page_rec_check(rec));
mach_write_to_2(slot, page_offset(rec));
}
-/*******************************************************************
-Gets the number of records owned by a directory slot. */
+/***************************************************************//**
+Gets the number of records owned by a directory slot.
+@return number of records */
UNIV_INLINE
ulint
page_dir_slot_get_n_owned(
/*======================*/
- /* out: number of records */
- const page_dir_slot_t* slot) /* in: page directory slot */
+ const page_dir_slot_t* slot) /*!< in: page directory slot */
{
const rec_t* rec = page_dir_slot_get_rec(slot);
if (page_rec_is_comp(slot)) {
@@ -634,15 +650,15 @@ page_dir_slot_get_n_owned(
}
}
-/*******************************************************************
+/***************************************************************//**
This is used to set the owned records field of a directory slot. */
UNIV_INLINE
void
page_dir_slot_set_n_owned(
/*======================*/
- page_dir_slot_t*slot, /* in/out: directory slot */
- page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
- ulint n) /* in: number of records owned by the slot */
+ page_dir_slot_t*slot, /*!< in/out: directory slot */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
+ ulint n) /*!< in: number of records owned by the slot */
{
rec_t* rec = (rec_t*) page_dir_slot_get_rec(slot);
if (page_rec_is_comp(slot)) {
@@ -653,7 +669,7 @@ page_dir_slot_set_n_owned(
}
}
-/****************************************************************
+/************************************************************//**
Calculates the space reserved for directory slots of a given number of
records. The exact value is a fraction number n * PAGE_DIR_SLOT_SIZE /
PAGE_DIR_SLOT_MIN_N_OWNED, and it is rounded upwards to an integer. */
@@ -661,21 +677,21 @@ UNIV_INLINE
ulint
page_dir_calc_reserved_space(
/*=========================*/
- ulint n_recs) /* in: number of records */
+ ulint n_recs) /*!< in: number of records */
{
return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1)
/ PAGE_DIR_SLOT_MIN_N_OWNED);
}
-/****************************************************************
-Gets the pointer to the next record on the page. */
+/************************************************************//**
+Gets the pointer to the next record on the page.
+@return pointer to next record */
UNIV_INLINE
const rec_t*
page_rec_get_next_low(
/*==================*/
- /* out: pointer to next record */
- const rec_t* rec, /* in: pointer to record */
- ulint comp) /* in: nonzero=compact page layout */
+ const rec_t* rec, /*!< in: pointer to record */
+ ulint comp) /*!< in: nonzero=compact page layout */
{
ulint offs;
const page_t* page;
@@ -708,39 +724,39 @@ page_rec_get_next_low(
return(page + offs);
}
-/****************************************************************
-Gets the pointer to the next record on the page. */
+/************************************************************//**
+Gets the pointer to the next record on the page.
+@return pointer to next record */
UNIV_INLINE
rec_t*
page_rec_get_next(
/*==============*/
- /* out: pointer to next record */
- rec_t* rec) /* in: pointer to record */
+ rec_t* rec) /*!< in: pointer to record */
{
return((rec_t*) page_rec_get_next_low(rec, page_rec_is_comp(rec)));
}
-/****************************************************************
-Gets the pointer to the next record on the page. */
+/************************************************************//**
+Gets the pointer to the next record on the page.
+@return pointer to next record */
UNIV_INLINE
const rec_t*
page_rec_get_next_const(
/*====================*/
- /* out: pointer to next record */
- const rec_t* rec) /* in: pointer to record */
+ const rec_t* rec) /*!< in: pointer to record */
{
return(page_rec_get_next_low(rec, page_rec_is_comp(rec)));
}
-/****************************************************************
+/************************************************************//**
Sets the pointer to the next record on the page. */
UNIV_INLINE
void
page_rec_set_next(
/*==============*/
- rec_t* rec, /* in: pointer to record,
+ rec_t* rec, /*!< in: pointer to record,
must not be page supremum */
- rec_t* next) /* in: pointer to next record,
+ rec_t* next) /*!< in: pointer to next record,
must not be page infimum */
{
ulint offs;
@@ -765,14 +781,14 @@ page_rec_set_next(
}
}
-/****************************************************************
-Gets the pointer to the previous record. */
+/************************************************************//**
+Gets the pointer to the previous record.
+@return pointer to previous record */
UNIV_INLINE
const rec_t*
page_rec_get_prev_const(
/*====================*/
- /* out: pointer to previous record */
- const rec_t* rec) /* in: pointer to record, must not be page
+ const rec_t* rec) /*!< in: pointer to record, must not be page
infimum */
{
const page_dir_slot_t* slot;
@@ -812,27 +828,27 @@ page_rec_get_prev_const(
return(prev_rec);
}
-/****************************************************************
-Gets the pointer to the previous record. */
+/************************************************************//**
+Gets the pointer to the previous record.
+@return pointer to previous record */
UNIV_INLINE
rec_t*
page_rec_get_prev(
/*==============*/
- /* out: pointer to previous record */
- rec_t* rec) /* in: pointer to record, must not be page
+ rec_t* rec) /*!< in: pointer to record, must not be page
infimum */
{
return((rec_t*) page_rec_get_prev_const(rec));
}
-/*******************************************************************
-Looks for the record which owns the given record. */
+/***************************************************************//**
+Looks for the record which owns the given record.
+@return the owner record */
UNIV_INLINE
rec_t*
page_rec_find_owner_rec(
/*====================*/
- /* out: the owner record */
- rec_t* rec) /* in: the physical record */
+ rec_t* rec) /*!< in: the physical record */
{
ut_ad(page_rec_check(rec));
@@ -849,16 +865,15 @@ page_rec_find_owner_rec(
return(rec);
}
-/**************************************************************
+/**********************************************************//**
Returns the base extra size of a physical record. This is the
-size of the fixed header, independent of the record size. */
+size of the fixed header, independent of the record size.
+@return REC_N_NEW_EXTRA_BYTES or REC_N_OLD_EXTRA_BYTES */
UNIV_INLINE
ulint
page_rec_get_base_extra_size(
/*=========================*/
- /* out: REC_N_NEW_EXTRA_BYTES
- or REC_N_OLD_EXTRA_BYTES */
- const rec_t* rec) /* in: physical record */
+ const rec_t* rec) /*!< in: physical record */
{
#if REC_N_NEW_EXTRA_BYTES + 1 != REC_N_OLD_EXTRA_BYTES
# error "REC_N_NEW_EXTRA_BYTES + 1 != REC_N_OLD_EXTRA_BYTES"
@@ -866,15 +881,15 @@ page_rec_get_base_extra_size(
return(REC_N_NEW_EXTRA_BYTES + (ulint) !page_rec_is_comp(rec));
}
-/****************************************************************
+/************************************************************//**
Returns the sum of the sizes of the records in the record list, excluding
-the infimum and supremum records. */
+the infimum and supremum records.
+@return data in bytes */
UNIV_INLINE
ulint
page_get_data_size(
/*===============*/
- /* out: data in bytes */
- const page_t* page) /* in: index page */
+ const page_t* page) /*!< in: index page */
{
ulint ret;
@@ -890,19 +905,19 @@ page_get_data_size(
}
-/****************************************************************
+/************************************************************//**
Allocates a block of memory from the free list of an index page. */
-UNIV_INTERN
+UNIV_INLINE
void
page_mem_alloc_free(
/*================*/
- page_t* page, /* in/out: index page */
- page_zip_des_t* page_zip,/* in/out: compressed page with enough
+ page_t* page, /*!< in/out: index page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
space available for inserting the record,
or NULL */
- rec_t* next_rec,/* in: pointer to the new head of the
+ rec_t* next_rec,/*!< in: pointer to the new head of the
free record list */
- ulint need) /* in: number of bytes allocated */
+ ulint need) /*!< in: number of bytes allocated */
{
ulint garbage;
@@ -923,14 +938,14 @@ page_mem_alloc_free(
page_header_set_field(page, page_zip, PAGE_GARBAGE, garbage - need);
}
-/*****************************************************************
-Calculates free space if a page is emptied. */
+/*************************************************************//**
+Calculates free space if a page is emptied.
+@return free space */
UNIV_INLINE
ulint
page_get_free_space_of_empty(
/*=========================*/
- /* out: free space */
- ulint comp) /* in: nonzero=compact page layout */
+ ulint comp) /*!< in: nonzero=compact page layout */
{
if (UNIV_LIKELY(comp)) {
return((ulint)(UNIV_PAGE_SIZE
@@ -945,21 +960,20 @@ page_get_free_space_of_empty(
- 2 * PAGE_DIR_SLOT_SIZE));
}
-/****************************************************************
+/************************************************************//**
Each user record on a page, and also the deleted user records in the heap
takes its size plus the fraction of the dir cell size /
PAGE_DIR_SLOT_MIN_N_OWNED bytes for it. If the sum of these exceeds the
value of page_get_free_space_of_empty, the insert is impossible, otherwise
it is allowed. This function returns the maximum combined size of records
-which can be inserted on top of the record heap. */
+which can be inserted on top of the record heap.
+@return maximum combined size for inserted records */
UNIV_INLINE
ulint
page_get_max_insert_size(
/*=====================*/
- /* out: maximum combined size for
- inserted records */
- const page_t* page, /* in: index page */
- ulint n_recs) /* in: number of records */
+ const page_t* page, /*!< in: index page */
+ ulint n_recs) /*!< in: number of records */
{
ulint occupied;
ulint free_space;
@@ -992,17 +1006,16 @@ page_get_max_insert_size(
return(free_space - occupied);
}
-/****************************************************************
+/************************************************************//**
Returns the maximum combined size of records which can be inserted on top
-of the record heap if a page is first reorganized. */
+of the record heap if a page is first reorganized.
+@return maximum combined size for inserted records */
UNIV_INLINE
ulint
page_get_max_insert_size_after_reorganize(
/*======================================*/
- /* out: maximum combined size for
- inserted records */
- const page_t* page, /* in: index page */
- ulint n_recs) /* in: number of records */
+ const page_t* page, /*!< in: index page */
+ ulint n_recs) /*!< in: number of records */
{
ulint occupied;
ulint free_space;
@@ -1020,17 +1033,17 @@ page_get_max_insert_size_after_reorganize(
return(free_space - occupied);
}
-/****************************************************************
+/************************************************************//**
Puts a record to free list. */
UNIV_INLINE
void
page_mem_free(
/*==========*/
- page_t* page, /* in/out: index page */
- page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
- rec_t* rec, /* in: pointer to the (origin of) record */
- dict_index_t* index, /* in: index of rec */
- const ulint* offsets)/* in: array returned by rec_get_offsets() */
+ page_t* page, /*!< in/out: index page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
+ rec_t* rec, /*!< in: pointer to the (origin of) record */
+ dict_index_t* index, /*!< in: index of rec */
+ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
rec_t* free;
ulint garbage;