summaryrefslogtreecommitdiff
path: root/storage/innobase/include/page0page.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/page0page.ic')
-rw-r--r--storage/innobase/include/page0page.ic93
1 files changed, 79 insertions, 14 deletions
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 0062db56bfa..ee908896050 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -186,7 +186,7 @@ page_header_set_field(
Returns the offset stored in the given header field.
@return offset from the start of the page, or 0 */
UNIV_INLINE
-ulint
+uint16_t
page_header_get_offs(
/*=================*/
const page_t* page, /*!< in: page */
@@ -464,7 +464,7 @@ Gets the number of user records on page (infimum and supremum records
are not user records).
@return number of user records */
UNIV_INLINE
-ulint
+uint16_t
page_get_n_recs(
/*============*/
const page_t* page) /*!< in: index page */
@@ -477,7 +477,7 @@ page_get_n_recs(
Gets the number of dir slots in directory.
@return number of slots */
UNIV_INLINE
-ulint
+uint16_t
page_dir_get_n_slots(
/*=================*/
const page_t* page) /*!< in: index page */
@@ -502,7 +502,7 @@ page_dir_set_n_slots(
Gets the number of records in the heap.
@return number of user records */
UNIV_INLINE
-ulint
+uint16_t
page_dir_get_n_heap(
/*================*/
const page_t* page) /*!< in: index page */
@@ -868,21 +868,17 @@ Returns the sum of the sizes of the records in the record list, excluding
the infimum and supremum records.
@return data in bytes */
UNIV_INLINE
-ulint
+uint16_t
page_get_data_size(
/*===============*/
const page_t* page) /*!< in: index page */
{
- ulint ret;
-
- ret = (ulint)(page_header_get_field(page, PAGE_HEAP_TOP)
- - (page_is_comp(page)
- ? PAGE_NEW_SUPREMUM_END
- : PAGE_OLD_SUPREMUM_END)
- - page_header_get_field(page, PAGE_GARBAGE));
-
+ uint16_t ret = page_header_get_field(page, PAGE_HEAP_TOP)
+ - (page_is_comp(page)
+ ? PAGE_NEW_SUPREMUM_END
+ : PAGE_OLD_SUPREMUM_END)
+ - page_header_get_field(page, PAGE_GARBAGE);
ut_ad(ret < UNIV_PAGE_SIZE);
-
return(ret);
}
@@ -1078,6 +1074,75 @@ page_mem_free(
}
}
+/** Read the PAGE_DIRECTION field from a byte.
+@param[in] ptr pointer to PAGE_DIRECTION_B
+@return the value of the PAGE_DIRECTION field */
+inline
+byte
+page_ptr_get_direction(const byte* ptr)
+{
+ ut_ad(page_offset(ptr) == PAGE_HEADER + PAGE_DIRECTION_B);
+ return *ptr & ((1U << 3) - 1);
+}
+
+/** Set the PAGE_DIRECTION field.
+@param[in] ptr pointer to PAGE_DIRECTION_B
+@param[in] dir the value of the PAGE_DIRECTION field */
+inline
+void
+page_ptr_set_direction(byte* ptr, byte dir)
+{
+ ut_ad(page_offset(ptr) == PAGE_HEADER + PAGE_DIRECTION_B);
+ ut_ad(dir >= PAGE_LEFT);
+ ut_ad(dir <= PAGE_NO_DIRECTION);
+ *ptr = (*ptr & ~((1U << 3) - 1)) | dir;
+}
+
+/** Read the PAGE_INSTANT field.
+@param[in] page index page
+@return the value of the PAGE_INSTANT field */
+inline
+uint16_t
+page_get_instant(const page_t* page)
+{
+ uint16_t i = page_header_get_field(page, PAGE_INSTANT);
+#ifdef UNIV_DEBUG
+ switch (fil_page_get_type(page)) {
+ case FIL_PAGE_TYPE_INSTANT:
+ ut_ad(page_get_direction(page) <= PAGE_NO_DIRECTION);
+ ut_ad(i >> 3);
+ break;
+ case FIL_PAGE_INDEX:
+ ut_ad(i <= PAGE_NO_DIRECTION || !page_is_comp(page));
+ break;
+ case FIL_PAGE_RTREE:
+ ut_ad(i == PAGE_NO_DIRECTION || i == 0);
+ break;
+ default:
+ ut_ad(!"invalid page type");
+ break;
+ }
+#endif /* UNIV_DEBUG */
+ return(i >> 3);
+}
+
+/** Assign the PAGE_INSTANT field.
+@param[in,out] page clustered index root page
+@param[in] n original number of clustered index fields
+@param[in,out] mtr mini-transaction */
+inline
+void
+page_set_instant(page_t* page, unsigned n, mtr_t* mtr)
+{
+ ut_ad(fil_page_get_type(page) == FIL_PAGE_TYPE_INSTANT);
+ ut_ad(n > 0);
+ ut_ad(n < REC_MAX_N_FIELDS);
+ uint16_t i = page_header_get_field(page, PAGE_INSTANT);
+ ut_ad(i <= PAGE_NO_DIRECTION);
+ i |= n << 3;
+ mlog_write_ulint(PAGE_HEADER + PAGE_INSTANT + page, i,
+ MLOG_2BYTES, mtr);
+}
#endif /* !UNIV_INNOCHECKSUM */
#ifdef UNIV_MATERIALIZE