summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-11-11 15:21:58 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-11-11 15:21:58 +0200
commit0117d0e65ac8051bc9f6d14764a2ab05e69bd895 (patch)
treed1e4caed5ef82fa8b46106321da4491ee57420e3
parentbce71a2909a8add9d0ca848bb387bacfd6e588e9 (diff)
parent0308de94ee806c21b6776ecab73396da75282596 (diff)
downloadmariadb-git-0117d0e65ac8051bc9f6d14764a2ab05e69bd895.tar.gz
Merge 10.4 into 10.5
-rw-r--r--storage/innobase/btr/btr0btr.cc90
-rw-r--r--storage/innobase/btr/btr0cur.cc41
-rw-r--r--storage/innobase/btr/btr0defragment.cc2
-rw-r--r--storage/innobase/btr/btr0pcur.cc6
-rw-r--r--storage/innobase/btr/btr0scrub.cc10
-rw-r--r--storage/innobase/btr/btr0sea.cc10
-rw-r--r--storage/innobase/dict/dict0boot.cc3
-rw-r--r--storage/innobase/dict/dict0crea.cc13
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc24
-rw-r--r--storage/innobase/gis/gis0rtree.cc39
-rw-r--r--storage/innobase/gis/gis0sea.cc4
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc8
-rw-r--r--storage/innobase/include/btr0btr.h37
-rw-r--r--storage/innobase/include/btr0btr.ic33
-rw-r--r--storage/innobase/include/fut0lst.h8
-rw-r--r--storage/innobase/include/fut0lst.ic4
-rw-r--r--storage/innobase/include/page0page.h11
-rw-r--r--storage/innobase/include/page0page.ic21
-rw-r--r--storage/innobase/row/row0merge.cc2
19 files changed, 129 insertions, 237 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 0a93b6bfda7..31419ed85a1 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -319,26 +319,24 @@ btr_root_fseg_adjust_on_import(
fseg_header_t* seg_header, /*!< in/out: segment header */
page_zip_des_t* page_zip, /*!< in/out: compressed page,
or NULL */
- ulint space, /*!< in: tablespace identifier */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ ulint space) /*!< in: tablespace identifier */
{
ulint offset = mach_read_from_2(seg_header + FSEG_HDR_OFFSET);
if (offset < FIL_PAGE_DATA
|| offset > srv_page_size - FIL_PAGE_DATA_END) {
+ return false;
+ }
- return(FALSE);
+ seg_header += FSEG_HDR_SPACE;
- } else if (page_zip) {
- mach_write_to_4(seg_header + FSEG_HDR_SPACE, space);
- page_zip_write_header(page_zip, seg_header + FSEG_HDR_SPACE,
- 4, mtr);
- } else {
- mlog_write_ulint(seg_header + FSEG_HDR_SPACE,
- space, MLOG_4BYTES, mtr);
+ mach_write_to_4(seg_header, space);
+ if (UNIV_LIKELY_NULL(page_zip)) {
+ memcpy(page_zip->data + page_offset(seg_header), seg_header,
+ 4);
}
- return(TRUE);
+ return true;
}
/**************************************************************//**
@@ -415,10 +413,10 @@ btr_root_adjust_on_import(
if (err == DB_SUCCESS
&& (!btr_root_fseg_adjust_on_import(
FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
- + page, page_zip, table->space_id, &mtr)
+ + page, page_zip, table->space_id)
|| !btr_root_fseg_adjust_on_import(
FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
- + page, page_zip, table->space_id, &mtr))) {
+ + page, page_zip, table->space_id))) {
err = DB_CORRUPTION;
}
@@ -2046,13 +2044,7 @@ btr_root_raise_and_insert(
btr_set_instant(root_block, *index, mtr);
}
- /* Set the next node and previous node fields, although
- they should already have been set. The previous node field
- must be FIL_NULL if root_page_zip != NULL, because the
- REC_INFO_MIN_REC_FLAG (of the first user record) will be
- set if and only if !page_has_prev(). */
- btr_page_set_next(root, root_page_zip, FIL_NULL, mtr);
- btr_page_set_prev(root, root_page_zip, FIL_NULL, mtr);
+ ut_ad(!page_has_siblings(root));
page_cursor = btr_cur_get_page_cur(cursor);
@@ -2557,8 +2549,8 @@ btr_attach_half_pages(
ut_ad(level == btr_page_get_level(buf_block_get_frame(new_block)));
/* Get the previous and next pages of page */
- prev_page_no = btr_page_get_prev(page, mtr);
- next_page_no = btr_page_get_next(page, mtr);
+ prev_page_no = btr_page_get_prev(page);
+ next_page_no = btr_page_get_next(page);
/* for consistency, both blocks should be locked, before change */
if (prev_page_no != FIL_NULL && direction == FSP_DOWN) {
@@ -2590,7 +2582,7 @@ btr_attach_half_pages(
if (prev_block) {
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(prev_block->frame) == page_is_comp(page));
- ut_a(btr_page_get_next(prev_block->frame, mtr)
+ ut_a(btr_page_get_next(prev_block->frame)
== block->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
@@ -2602,7 +2594,7 @@ btr_attach_half_pages(
if (next_block) {
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_block->frame) == page_is_comp(page));
- ut_a(btr_page_get_prev(next_block->frame, mtr)
+ ut_a(btr_page_get_prev(next_block->frame)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
@@ -2616,7 +2608,7 @@ btr_attach_half_pages(
btr_page_set_prev(lower_page, lower_page_zip,
prev_page_no, mtr);
} else {
- ut_ad(btr_page_get_prev(lower_page, mtr) == prev_page_no);
+ ut_ad(btr_page_get_prev(lower_page) == prev_page_no);
}
btr_page_set_next(lower_page, lower_page_zip, upper_page_no, mtr);
@@ -2627,7 +2619,7 @@ btr_attach_half_pages(
btr_page_set_next(upper_page, upper_page_zip,
next_page_no, mtr);
} else {
- ut_ad(btr_page_get_next(upper_page, mtr) == next_page_no);
+ ut_ad(btr_page_get_next(upper_page) == next_page_no);
}
}
@@ -2688,7 +2680,7 @@ btr_insert_into_right_sibling(
{
buf_block_t* block = btr_cur_get_block(cursor);
page_t* page = buf_block_get_frame(block);
- ulint next_page_no = btr_page_get_next(page, mtr);
+ const uint32_t next_page_no = btr_page_get_next(page);
ut_ad(mtr_memo_contains_flagged(
mtr, dict_index_get_lock(cursor->index),
@@ -3212,8 +3204,8 @@ void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
/* Get the previous and next page numbers of page */
const page_t* page = block.frame;
- const ulint prev_page_no = btr_page_get_prev(page, mtr);
- const ulint next_page_no = btr_page_get_next(page, mtr);
+ const uint32_t prev_page_no = btr_page_get_prev(page);
+ const uint32_t next_page_no = btr_page_get_next(page);
/* Update page links of the level */
@@ -3225,8 +3217,8 @@ void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
= buf_block_get_frame(prev_block);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(prev_page) == page_is_comp(page));
- ut_a(btr_page_get_next(prev_page, mtr)
- == page_get_page_no(page));
+ ut_a(!memcmp(prev_page + FIL_PAGE_NEXT, page + FIL_PAGE_OFFSET,
+ 4));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page,
@@ -3242,8 +3234,8 @@ void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
= buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
- ut_a(btr_page_get_prev(next_page, mtr)
- == page_get_page_no(page));
+ ut_a(!memcmp(next_page + FIL_PAGE_PREV, page + FIL_PAGE_OFFSET,
+ 4));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_prev(next_page,
@@ -3576,8 +3568,8 @@ btr_compress(
MONITOR_INC(MONITOR_INDEX_MERGE_ATTEMPTS);
- left_page_no = btr_page_get_prev(page, mtr);
- right_page_no = btr_page_get_next(page, mtr);
+ left_page_no = btr_page_get_prev(page);
+ right_page_no = btr_page_get_next(page);
#ifdef UNIV_DEBUG
if (!page_is_leaf(page) && left_page_no == FIL_NULL) {
@@ -3651,10 +3643,10 @@ retry:
#ifdef UNIV_BTR_DEBUG
if (is_left) {
- ut_a(btr_page_get_next(merge_page, mtr)
+ ut_a(btr_page_get_next(merge_page)
== block->page.id.page_no());
} else {
- ut_a(btr_page_get_prev(merge_page, mtr)
+ ut_a(btr_page_get_prev(merge_page)
== block->page.id.page_no());
}
#endif /* UNIV_BTR_DEBUG */
@@ -4196,8 +4188,8 @@ btr_discard_page(
/* Decide the page which will inherit the locks */
- left_page_no = btr_page_get_prev(buf_block_get_frame(block), mtr);
- right_page_no = btr_page_get_next(buf_block_get_frame(block), mtr);
+ left_page_no = btr_page_get_prev(buf_block_get_frame(block));
+ right_page_no = btr_page_get_next(buf_block_get_frame(block));
ut_d(bool parent_is_different = false);
if (left_page_no != FIL_NULL) {
@@ -4205,7 +4197,7 @@ btr_discard_page(
true, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_next(merge_page, mtr)
+ ut_a(btr_page_get_next(merge_page)
== block->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
ut_d(parent_is_different =
@@ -4219,7 +4211,7 @@ btr_discard_page(
true, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_prev(merge_page, mtr)
+ ut_a(btr_page_get_prev(merge_page)
== block->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
ut_d(parent_is_different = page_rec_is_supremum(
@@ -4858,7 +4850,7 @@ btr_validate_level(
does not use such scan for any of its DML or query
operations */
if (dict_index_is_spatial(index)) {
- left_page_no = btr_page_get_prev(page, &mtr);
+ left_page_no = btr_page_get_prev(page);
while (left_page_no != FIL_NULL) {
/* To obey latch order of tree blocks,
@@ -4872,7 +4864,7 @@ btr_validate_level(
RW_SX_LATCH, false,
&mtr);
page = buf_block_get_frame(block);
- left_page_no = btr_page_get_prev(page, &mtr);
+ left_page_no = btr_page_get_prev(page);
}
}
}
@@ -4927,8 +4919,8 @@ loop:
ut_a(btr_page_get_level(page) == level);
- right_page_no = btr_page_get_next(page, &mtr);
- left_page_no = btr_page_get_prev(page, &mtr);
+ right_page_no = btr_page_get_next(page);
+ left_page_no = btr_page_get_prev(page);
ut_a(!page_is_empty(page)
|| (level == 0
@@ -4942,9 +4934,7 @@ loop:
!level, &mtr);
right_page = buf_block_get_frame(right_block);
- if (btr_page_get_prev(right_page, &mtr)
- != page_get_page_no(page)) {
-
+ if (btr_page_get_prev(right_page) != page_get_page_no(page)) {
btr_validate_report2(index, level, block, right_block);
fputs("InnoDB: broken FIL_PAGE_NEXT"
" or FIL_PAGE_PREV links\n", stderr);
@@ -5025,7 +5015,7 @@ loop:
node_ptr = btr_cur_get_rec(&node_cur);
parent_page_no = page_get_page_no(father_page);
- parent_right_page_no = btr_page_get_next(father_page, &mtr);
+ parent_right_page_no = btr_page_get_next(father_page);
rightmost_child = page_rec_is_supremum(
page_rec_get_next(node_ptr));
@@ -5161,7 +5151,7 @@ loop:
}
if (page_get_page_no(right_father_page)
- != btr_page_get_next(father_page, &mtr)) {
+ != btr_page_get_next(father_page)) {
ret = false;
fputs("InnoDB: node pointer 3 to"
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index a3fb214cd80..9bf88f66889 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -221,8 +221,8 @@ btr_cur_latch_leaves(
mtr_t* mtr)
{
rw_lock_type_t mode;
- ulint left_page_no;
- ulint right_page_no;
+ uint32_t left_page_no;
+ uint32_t right_page_no;
buf_block_t* get_block;
page_t* page = buf_block_get_frame(block);
bool spatial;
@@ -268,7 +268,7 @@ btr_cur_latch_leaves(
dict_index_get_lock(cursor->index),
MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK));
/* x-latch also siblings from left to right */
- left_page_no = btr_page_get_prev(page, mtr);
+ left_page_no = btr_page_get_prev(page);
if (left_page_no != FIL_NULL) {
@@ -304,10 +304,9 @@ btr_cur_latch_leaves(
/* Sanity check only after both the blocks are latched. */
if (latch_leaves.blocks[0] != NULL) {
ut_a(page_is_comp(latch_leaves.blocks[0]->frame)
- == page_is_comp(page));
- ut_a(btr_page_get_next(
- latch_leaves.blocks[0]->frame, mtr)
- == page_get_page_no(page));
+ == page_is_comp(page));
+ ut_a(btr_page_get_next(latch_leaves.blocks[0]->frame)
+ == page_get_page_no(page));
}
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -317,7 +316,7 @@ btr_cur_latch_leaves(
= get_block;
}
- right_page_no = btr_page_get_next(page, mtr);
+ right_page_no = btr_page_get_next(page);
if (right_page_no != FIL_NULL) {
if (spatial) {
@@ -333,7 +332,7 @@ btr_cur_latch_leaves(
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
- ut_a(btr_page_get_prev(get_block->frame, mtr)
+ ut_a(btr_page_get_prev(get_block->frame)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
if (spatial) {
@@ -349,7 +348,7 @@ btr_cur_latch_leaves(
mode = latch_mode == BTR_SEARCH_PREV ? RW_S_LATCH : RW_X_LATCH;
/* latch also left sibling */
rw_lock_s_lock(&block->lock);
- left_page_no = btr_page_get_prev(page, mtr);
+ left_page_no = btr_page_get_prev(page);
rw_lock_s_unlock(&block->lock);
if (left_page_no != FIL_NULL) {
@@ -362,7 +361,7 @@ btr_cur_latch_leaves(
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
- ut_a(btr_page_get_next(get_block->frame, mtr)
+ ut_a(btr_page_get_next(get_block->frame)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
}
@@ -756,7 +755,7 @@ btr_cur_optimistic_latch_leaves(
goto unpin_failed;
}
- left_page_no = btr_page_get_prev(block->frame, mtr);
+ left_page_no = btr_page_get_prev(block->frame);
rw_lock_s_unlock(&block->lock);
cursor->left_block = left_page_no != FIL_NULL
@@ -766,8 +765,7 @@ btr_cur_optimistic_latch_leaves(
if (buf_page_optimistic_get(mode, block, modify_clock,
file, line, mtr)) {
- if (btr_page_get_prev(block->frame, mtr)
- == left_page_no) {
+ if (btr_page_get_prev(block->frame) == left_page_no) {
buf_block_buf_fix_dec(block);
*latch_mode = mode;
return(true);
@@ -1645,8 +1643,7 @@ retry_page_get:
rw_latch = upper_rw_latch;
rw_lock_s_lock(&block->lock);
- left_page_no = btr_page_get_prev(
- buf_block_get_frame(block), mtr);
+ left_page_no = btr_page_get_prev(buf_block_get_frame(block));
rw_lock_s_unlock(&block->lock);
if (left_page_no != FIL_NULL) {
@@ -3719,10 +3716,7 @@ btr_cur_pessimistic_insert(
}
if (!page_rec_is_infimum(btr_cur_get_rec(cursor))
- || btr_page_get_prev(
- buf_block_get_frame(
- btr_cur_get_block(cursor)), mtr)
- == FIL_NULL) {
+ || !page_has_prev(btr_cur_get_page(cursor))) {
/* split and inserted need to call
lock_update_insert() always. */
inherit = true;
@@ -4708,7 +4702,7 @@ btr_cur_pess_upd_restore_supremum(
return;
}
- const ulint prev_page_no = btr_page_get_prev(page, mtr);
+ const uint32_t prev_page_no = btr_page_get_prev(page);
const page_id_t page_id(block->page.id.space(), prev_page_no);
@@ -4716,8 +4710,7 @@ btr_cur_pess_upd_restore_supremum(
prev_block = buf_page_get_with_no_latch(page_id, block->zip_size(),
mtr);
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_next(prev_block->frame, mtr)
- == page_get_page_no(page));
+ ut_a(btr_page_get_next(prev_block->frame) == block->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
/* We must already have an x-latch on prev_block! */
@@ -6270,7 +6263,7 @@ btr_estimate_n_rows_in_range_on_level(
n_rows += page_get_n_recs(page);
}
- page_id.set_page_no(btr_page_get_next(page, &mtr));
+ page_id.set_page_no(btr_page_get_next(page));
mtr_commit(&mtr);
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 631527d2f1f..15e4e6cd70b 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -576,7 +576,7 @@ btr_defragment_n_pages(
blocks[0] = block;
for (uint i = 1; i <= n_pages; i++) {
page_t* page = buf_block_get_frame(blocks[i-1]);
- ulint page_no = btr_page_get_next(page, mtr);
+ ulint page_no = btr_page_get_next(page);
total_data_size += page_get_data_size(page);
total_n_recs += page_get_n_recs(page);
if (page_no == FIL_NULL) {
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index 4bc932b18a7..515a255f170 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -451,7 +451,7 @@ btr_pcur_move_to_next_page(
return;
}
- const ulint next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
+ const uint32_t next_page_no = btr_page_get_next(page);
ut_ad(next_page_no != FIL_NULL);
@@ -475,7 +475,7 @@ btr_pcur_move_to_next_page(
const page_t* next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
- ut_a(btr_page_get_prev(next_page, mtr)
+ ut_a(btr_page_get_prev(next_page)
== btr_pcur_get_block(cursor)->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
@@ -537,7 +537,7 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor);
- prev_page_no = btr_page_get_prev(page, mtr);
+ prev_page_no = btr_page_get_prev(page);
if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor)) {
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index b8d3e2e50fa..63c2271c1e3 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -431,9 +431,9 @@ btr_pessimistic_scrub(
}
/* read block variables */
- const ulint page_no = block->page.id.page_no();
- const ulint left_page_no = mach_read_from_4(page + FIL_PAGE_PREV);
- const ulint right_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
+ const uint32_t page_no = block->page.id.page_no();
+ const uint32_t left_page_no = btr_page_get_prev(page);
+ const uint32_t right_page_no = btr_page_get_next(page);
/**
* When splitting page, we need X-latches on left/right brothers
@@ -462,8 +462,8 @@ btr_pessimistic_scrub(
/**
* structure should be unchanged
*/
- ut_a(left_page_no == btr_page_get_prev(page, mtr));
- ut_a(right_page_no == btr_page_get_next(page, mtr));
+ ut_a(left_page_no == btr_page_get_prev(page));
+ ut_a(right_page_no == btr_page_get_next(page));
}
if (right_page_no != FIL_NULL) {
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 3cc7c6b825b..f073dbccdbd 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -782,10 +782,7 @@ btr_search_check_guess(
const rec_t* prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) {
- success = *reinterpret_cast<const uint32_t*>(
- page_align(prev_rec) + FIL_PAGE_PREV)
- == FIL_NULL;
-
+ success = !page_has_prev(page_align(prev_rec));
goto exit_func;
}
@@ -804,10 +801,7 @@ btr_search_check_guess(
const rec_t* next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) {
- if (*reinterpret_cast<const uint32_t*>(
- page_align(next_rec) + FIL_PAGE_NEXT)
- == FIL_NULL) {
-
+ if (!page_has_next(page_align(next_rec))) {
cursor->up_match = 0;
success = TRUE;
}
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index 618f6a2ad40..cb763e6b099 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -160,8 +160,7 @@ dict_hdr_create(
mlog_write_ull(dict_header + DICT_HDR_INDEX_ID,
DICT_HDR_FIRST_ID, mtr);
- mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
- 0, MLOG_4BYTES, mtr);
+ ut_ad(mach_read_from_4(dict_header + DICT_HDR_MAX_SPACE_ID) == 0);
/* Obsolete, but we must initialize it anyway. */
mlog_write_ulint(dict_header + DICT_HDR_MIX_ID_LOW,
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 5c9dd5be9ab..b67ddd533bf 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -851,11 +851,14 @@ dict_create_index_tree_step(
err = DB_OUT_OF_FILE_SPACE; );
}
- page_rec_write_field(
- btr_pcur_get_rec(&pcur), DICT_FLD__SYS_INDEXES__PAGE_NO,
- node->page_no, &mtr);
-
- btr_pcur_close(&pcur);
+ ulint len;
+ byte* data = rec_get_nth_field_old(btr_pcur_get_rec(&pcur),
+ DICT_FLD__SYS_INDEXES__PAGE_NO,
+ &len);
+ ut_ad(len == 4);
+ if (mach_read_from_4(data) != node->page_no) {
+ mlog_write_ulint(data, node->page_no, MLOG_4BYTES, &mtr);
+ }
mtr.commit();
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index a35070cb9eb..039da3eb2bd 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1762,7 +1762,6 @@ fseg_create(
buf_block_t* block = 0; /* remove warning */
fseg_header_t* header = 0; /* remove warning */
ulint n_reserved;
- ulint i;
DBUG_ENTER("fseg_create");
@@ -1808,9 +1807,8 @@ fseg_create(
seg_id = mach_read_from_8(space_header + FSP_SEG_ID);
mlog_write_ull(space_header + FSP_SEG_ID, seg_id + 1, mtr);
-
mlog_write_ull(inode + FSEG_ID, seg_id, mtr);
- mlog_write_ulint(inode + FSEG_NOT_FULL_N_USED, 0, MLOG_4BYTES, mtr);
+ ut_ad(!mach_read_from_4(inode + FSEG_NOT_FULL_N_USED));
flst_init(inode + FSEG_FREE, mtr);
flst_init(inode + FSEG_NOT_FULL, mtr);
@@ -1818,9 +1816,10 @@ fseg_create(
mlog_write_ulint(inode + FSEG_MAGIC_N, FSEG_MAGIC_N_VALUE,
MLOG_4BYTES, mtr);
- for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
- fseg_set_nth_frag_page_no(inode, i, FIL_NULL, mtr);
- }
+ compile_time_assert(FSEG_FRAG_SLOT_SIZE == 4);
+ compile_time_assert(FIL_NULL == 0xffffffff);
+ mlog_memset(inode + FSEG_FRAG_ARR,
+ FSEG_FRAG_SLOT_SIZE * FSEG_FRAG_ARR_N_SLOTS, 0xff, mtr);
if (page == 0) {
block = fseg_alloc_free_page_low(space,
@@ -2645,15 +2644,16 @@ fseg_free_page_low(
if (state != XDES_FSEG) {
/* The page is in the fragment pages of the segment */
-
for (ulint i = 0;; i++) {
if (fseg_get_nth_frag_page_no(seg_inode, i, mtr)
- == offset) {
-
- fseg_set_nth_frag_page_no(seg_inode, i,
- FIL_NULL, mtr);
- break;
+ != offset) {
+ continue;
}
+
+ compile_time_assert(FIL_NULL == 0xffffffff);
+ mlog_memset(seg_inode + FSEG_FRAG_ARR
+ + i * FSEG_FRAG_SLOT_SIZE, 4, 0xff, mtr);
+ break;
}
fsp_free_page(space, offset, log, mtr);
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index cf78a61e9c5..1c1c2dd12f9 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -603,16 +603,10 @@ update_mbr:
}
}
-#ifdef UNIV_DEBUG
- ulint left_page_no = btr_page_get_prev(page, mtr);
-
- if (left_page_no == FIL_NULL) {
-
- ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits(
- page_rec_get_next(page_get_infimum_rec(page)),
- page_is_comp(page)));
- }
-#endif /* UNIV_DEBUG */
+ ut_ad(page_has_prev(page)
+ || (REC_INFO_MIN_REC_FLAG & rec_get_info_bits(
+ page_rec_get_next(page_get_infimum_rec(page)),
+ page_is_comp(page))));
mem_heap_free(heap);
@@ -646,8 +640,6 @@ rtr_adjust_upper_level(
mem_heap_t* heap;
ulint level;
dtuple_t* node_ptr_upper;
- ulint prev_page_no;
- ulint next_page_no;
page_cur_t* page_cursor;
lock_prdt_t prdt;
lock_prdt_t new_prdt;
@@ -748,33 +740,17 @@ rtr_adjust_upper_level(
mem_heap_free(heap);
- /* Get the previous and next pages of page */
- prev_page_no = btr_page_get_prev(page, mtr);
- next_page_no = btr_page_get_next(page, mtr);
ut_ad(block->zip_size() == index->table->space->zip_size());
- /* Update page links of the level */
- if (prev_page_no != FIL_NULL) {
- buf_block_t* prev_block = btr_block_get(
- *index, prev_page_no, RW_X_LATCH, false, mtr);
-#ifdef UNIV_BTR_DEBUG
- ut_a(page_is_comp(prev_block->frame) == page_is_comp(page));
- ut_a(btr_page_get_next(prev_block->frame, mtr)
- == block->page.id.page_no());
-#endif /* UNIV_BTR_DEBUG */
-
- btr_page_set_next(buf_block_get_frame(prev_block),
- buf_block_get_page_zip(prev_block),
- page_no, mtr);
- }
+ const uint32_t next_page_no = btr_page_get_next(page);
if (next_page_no != FIL_NULL) {
buf_block_t* next_block = btr_block_get(
*index, next_page_no, RW_X_LATCH, false, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_block->frame) == page_is_comp(page));
- ut_a(btr_page_get_prev(next_block->frame, mtr)
- == page_get_page_no(page));
+ ut_a(btr_page_get_prev(next_block->frame)
+ == block->page.id.page_no());
#endif /* UNIV_BTR_DEBUG */
btr_page_set_prev(buf_block_get_frame(next_block),
@@ -782,7 +758,6 @@ rtr_adjust_upper_level(
new_page_no, mtr);
}
- btr_page_set_prev(page, page_zip, prev_page_no, mtr);
btr_page_set_next(page, page_zip, new_page_no, mtr);
btr_page_set_prev(new_page, new_page_zip, page_no, mtr);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 0ec21c813b3..4b20fc8e114 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -288,7 +288,7 @@ rtr_pcur_getnext_from_path(
Note that we have SX lock on index->lock, there
should not be any split/shrink happening here */
if (page_ssn > path_ssn) {
- ulint next_page_no = btr_page_get_next(page, mtr);
+ uint32_t next_page_no = btr_page_get_next(page);
rtr_non_leaf_stack_push(
rtr_info->path, next_page_no, path_ssn,
level, 0, NULL, 0);
@@ -1388,7 +1388,7 @@ search_again:
/* Check the page SSN to see if it has been splitted, if so, search
the right page */
if (!ret && page_ssn > path_ssn) {
- page_no = btr_page_get_next(page, mtr);
+ page_no = btr_page_get_next(page);
goto search_again;
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 2f12b1e9aaf..844d6901ce5 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -2943,7 +2943,7 @@ ibuf_get_volume_buffered(
/* Look at the previous page */
- prev_page_no = btr_page_get_prev(page, mtr);
+ prev_page_no = btr_page_get_prev(page);
if (prev_page_no == FIL_NULL) {
@@ -2964,7 +2964,7 @@ ibuf_get_volume_buffered(
}
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_next(prev_page, mtr) == page_get_page_no(page));
+ ut_a(!memcmp(prev_page + FIL_PAGE_NEXT, page + FIL_PAGE_OFFSET, 4));
#endif /* UNIV_BTR_DEBUG */
rec = page_get_supremum_rec(prev_page);
@@ -3015,7 +3015,7 @@ count_later:
/* Look at the next page */
- next_page_no = btr_page_get_next(page, mtr);
+ next_page_no = btr_page_get_next(page);
if (next_page_no == FIL_NULL) {
@@ -3036,7 +3036,7 @@ count_later:
}
#ifdef UNIV_BTR_DEBUG
- ut_a(btr_page_get_prev(next_page, mtr) == page_get_page_no(page));
+ ut_a(!memcmp(next_page + FIL_PAGE_PREV, page + FIL_PAGE_OFFSET, 4));
#endif /* UNIV_BTR_DEBUG */
rec = page_get_infimum_rec(next_page);
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index efa00fe1ead..c58715560ee 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -293,26 +293,23 @@ btr_page_get_level(const page_t* page)
return(level);
} MY_ATTRIBUTE((warn_unused_result))
-/********************************************************//**
-Gets the next index page number.
-@return next page number */
-UNIV_INLINE
-ulint
-btr_page_get_next(
-/*==============*/
- const page_t* page, /*!< in: index page */
- mtr_t* mtr) /*!< in: mini-transaction handle */
- MY_ATTRIBUTE((warn_unused_result));
-/********************************************************//**
-Gets the previous index page number.
-@return prev page number */
-UNIV_INLINE
-ulint
-btr_page_get_prev(
-/*==============*/
- const page_t* page, /*!< in: index page */
- mtr_t* mtr) /*!< in: mini-transaction handle */
- MY_ATTRIBUTE((warn_unused_result));
+
+/** Read FIL_PAGE_NEXT.
+@param page buffer pool page
+@return previous page number */
+inline uint32_t btr_page_get_next(const page_t* page)
+{
+ return mach_read_from_4(page + FIL_PAGE_NEXT);
+}
+
+/** Read FIL_PAGE_PREV.
+@param page buffer pool page
+@return previous page number */
+inline uint32_t btr_page_get_prev(const page_t* page)
+{
+ return mach_read_from_4(page + FIL_PAGE_PREV);
+}
+
/**************************************************************//**
Releases the latch on a leaf page and bufferunfixes it. */
UNIV_INLINE
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index 93f27e0f4e7..bc990f728e6 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -91,23 +91,6 @@ btr_page_set_level(
}
/********************************************************//**
-Gets the next index page number.
-@return next page number */
-UNIV_INLINE
-ulint
-btr_page_get_next(
-/*==============*/
- const page_t* page, /*!< in: index page */
- mtr_t* mtr MY_ATTRIBUTE((unused)))
- /*!< in: mini-transaction handle */
-{
- ut_ad(page != NULL);
- ut_ad(mtr != NULL);
-
- return(mach_read_from_4(page + FIL_PAGE_NEXT));
-}
-
-/********************************************************//**
Sets the next index page field. */
UNIV_INLINE
void
@@ -131,22 +114,6 @@ btr_page_set_next(
}
/********************************************************//**
-Gets the previous index page number.
-@return prev page number */
-UNIV_INLINE
-ulint
-btr_page_get_prev(
-/*==============*/
- const page_t* page, /*!< in: index page */
- mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mini-transaction handle */
-{
- ut_ad(page != NULL);
- ut_ad(mtr != NULL);
-
- return(mach_read_from_4(page + FIL_PAGE_PREV));
-}
-
-/********************************************************//**
Sets the previous index page field. */
UNIV_INLINE
void
diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h
index 3f68660ae89..9fa928eda23 100644
--- a/storage/innobase/include/fut0lst.h
+++ b/storage/innobase/include/fut0lst.h
@@ -85,8 +85,12 @@ inline void flst_init(buf_block_t* block, uint16_t ofs, mtr_t* mtr)
@param[in,out] mtr mini-transaction */
inline void flst_zero_addr(fil_faddr_t* faddr, mtr_t* mtr)
{
- mlog_memset(faddr + FIL_ADDR_PAGE, 4, 0xff, mtr);
- mlog_write_ulint(faddr + FIL_ADDR_BYTE, 0, MLOG_2BYTES, mtr);
+ if (mach_read_from_4(faddr + FIL_ADDR_PAGE) != FIL_NULL) {
+ mlog_memset(faddr + FIL_ADDR_PAGE, 4, 0xff, mtr);
+ }
+ if (mach_read_from_2(faddr + FIL_ADDR_BYTE)) {
+ mlog_write_ulint(faddr + FIL_ADDR_BYTE, 0, MLOG_2BYTES, mtr);
+ }
}
/********************************************************************//**
diff --git a/storage/innobase/include/fut0lst.ic b/storage/innobase/include/fut0lst.ic
index 0a4f2b24738..ec4181b2c93 100644
--- a/storage/innobase/include/fut0lst.ic
+++ b/storage/innobase/include/fut0lst.ic
@@ -82,7 +82,9 @@ flst_init(
MTR_MEMO_PAGE_X_FIX
| MTR_MEMO_PAGE_SX_FIX));
- mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr);
+ if (mach_read_from_4(base + FLST_LEN)) {
+ mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr);
+ }
flst_zero_addr(base + FLST_FIRST, mtr);
flst_zero_addr(base + FLST_LAST, mtr);
}
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 95fc31d6c49..0d137086569 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -871,17 +871,6 @@ page_rec_find_owner_rec(
/*====================*/
rec_t* rec); /*!< in: the physical record */
-/***********************************************************************//**
-Write a 32-bit field in a data dictionary record. */
-UNIV_INLINE
-void
-page_rec_write_field(
-/*=================*/
- rec_t* rec, /*!< in/out: record to update */
- ulint i, /*!< in: index of the field to update */
- ulint val, /*!< in: value to write */
- mtr_t* mtr) /*!< in/out: mini-transaction */
- MY_ATTRIBUTE((nonnull));
/************************************************************//**
Returns the maximum combined size of records which can be inserted on top
of record heap.
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index bfe568c23a0..d13f5732faf 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -911,27 +911,6 @@ page_get_free_space_of_empty(
- 2 * PAGE_DIR_SLOT_SIZE));
}
-/***********************************************************************//**
-Write a 32-bit field in a data dictionary record. */
-UNIV_INLINE
-void
-page_rec_write_field(
-/*=================*/
- rec_t* rec, /*!< in/out: record to update */
- ulint i, /*!< in: index of the field to update */
- ulint val, /*!< in: value to write */
- mtr_t* mtr) /*!< in/out: mini-transaction */
-{
- byte* data;
- ulint len;
-
- data = rec_get_nth_field_old(rec, i, &len);
-
- ut_ad(len == 4);
-
- mlog_write_ulint(data, val, MLOG_4BYTES, mtr);
-}
-
/************************************************************//**
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 /
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 355f29acc08..dad2e060678 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2020,7 +2020,7 @@ end_of_index:
buf_block_t* block;
next_page_no = btr_page_get_next(
- page_cur_get_page(cur), &mtr);
+ page_cur_get_page(cur));
if (next_page_no == FIL_NULL) {
goto end_of_index;