Commit 4fcfdb60 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into 10.3

parents c4ee8a30 142442d5
......@@ -322,26 +322,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;
}
/**************************************************************//**
......@@ -399,10 +397,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;
}
......@@ -2002,13 +2000,7 @@ btr_root_raise_and_insert(
page_set_instant(root_block->frame, index->n_core_fields, 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);
......@@ -2510,8 +2502,8 @@ btr_attach_half_pages(
}
/* 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);
const ulint space = block->page.id.space();
......@@ -2551,7 +2543,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 */
......@@ -2563,7 +2555,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 */
......@@ -2577,7 +2569,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);
......@@ -2588,7 +2580,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);
}
}
......@@ -2649,7 +2641,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),
......@@ -3180,8 +3172,8 @@ btr_level_list_remove_func(
ut_ad(space == page_get_space_id(page));
/* Get the previous and next page numbers of page */
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 */
......@@ -3194,8 +3186,8 @@ btr_level_list_remove_func(
= 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,
......@@ -3213,8 +3205,8 @@ btr_level_list_remove_func(
= 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,
......@@ -3557,8 +3549,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) {
......@@ -3632,10 +3624,10 @@ btr_compress(
#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 */
......@@ -4153,8 +4145,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));
const page_size_t page_size(index->table->space->flags);
ut_d(bool parent_is_different = false);
......@@ -4165,7 +4157,7 @@ btr_discard_page(
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 =
......@@ -4181,7 +4173,7 @@ btr_discard_page(
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(
......@@ -4801,7 +4793,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,
......@@ -4817,7 +4809,7 @@ btr_validate_level(
table_page_size,
RW_SX_LATCH, index, &mtr);
page = buf_block_get_frame(block);
left_page_no = btr_page_get_prev(page, &mtr);
left_page_no = btr_page_get_prev(page);
}
}
}
......@@ -4872,8 +4864,8 @@ btr_validate_level(
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
......@@ -4890,9 +4882,7 @@ btr_validate_level(
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);
......@@ -4973,7 +4963,7 @@ btr_validate_level(
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));
......@@ -5114,7 +5104,7 @@ btr_validate_level(
}
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"
......
......@@ -269,7 +269,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);
mode = latch_mode;
if (left_page_no != FIL_NULL) {
......@@ -305,10 +305,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 */
......@@ -318,7 +317,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) {
......@@ -334,7 +333,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) {
......@@ -350,7 +349,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) {
......@@ -363,7 +362,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 */
}
......@@ -666,7 +665,7 @@ btr_cur_optimistic_latch_leaves(
goto unpin_failed;
}
left_page_no = btr_page_get_prev(
buf_block_get_frame(block), mtr);
buf_block_get_frame(block));
rw_lock_s_unlock(&block->lock);
if (left_page_no != FIL_NULL) {
......@@ -682,7 +681,7 @@ btr_cur_optimistic_latch_leaves(
if (buf_page_optimistic_get(mode, block, modify_clock,
file, line, mtr)) {
if (btr_page_get_prev(buf_block_get_frame(block), mtr)
if (btr_page_get_prev(buf_block_get_frame(block))
== left_page_no) {
buf_block_buf_fix_dec(block);
*latch_mode = mode;
......@@ -1560,8 +1559,7 @@ btr_cur_search_to_nth_level_func(
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) {
......@@ -3650,10 +3648,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;
......@@ -4525,15 +4520,14 @@ 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);
ut_ad(prev_page_no != FIL_NULL);
prev_block = buf_page_get_with_no_latch(page_id, block->page.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! */
......@@ -6065,7 +6059,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);
......@@ -7665,8 +7659,8 @@ btr_store_big_rec_extern_fields(
extern_len -= store_len;
mlog_write_ulint(field_ref + BTR_EXTERN_LEN, 0,
MLOG_4BYTES, &mtr);
ut_ad(!mach_read_from_4(BTR_EXTERN_LEN
+ field_ref));
mlog_write_ulint(field_ref
+ BTR_EXTERN_LEN + 4,
big_rec_vec->fields[i].len
......
......@@ -583,7 +583,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) {
......
......@@ -433,7 +433,7 @@ btr_pcur_move_to_next_page(
return;
}
next_page_no = btr_page_get_next(page, mtr);
next_page_no = btr_page_get_next(page);
ut_ad(next_page_no != FIL_NULL);
......@@ -460,7 +460,7 @@ btr_pcur_move_to_next_page(
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 */
......@@ -522,7 +522,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)) {
......
......@@ -432,8 +432,8 @@ btr_pessimistic_scrub(
/* read block variables */
const ulint page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
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 left_page_no = btr_page_get_prev(page);
const uint32_t right_page_no = btr_page_get_next(page);
const page_size_t page_size(index->table->space->flags);
/**
......@@ -465,8 +465,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) {
......
......@@ -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;
}
......
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation.
Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -198,8 +198,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,
......
......@@ -870,11 +870,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();
......
......@@ -1426,7 +1426,8 @@ fsp_free_page(
const ulint bit = offset % FSP_EXTENT_SIZE;
xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr);
xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr);
/* xdes_init() should have set all XDES_CLEAN_BIT */
ut_ad(xdes_get_bit(descr, XDES_CLEAN_BIT, bit));
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
mtr);
......@@ -1583,9 +1584,7 @@ fsp_alloc_seg_inode_page(
fsp_header_t* space_header,
mtr_t* mtr)
{
fseg_inode_t* inode;
buf_block_t* block;
page_t* page;
ut_ad(page_offset(space_header) == FSP_HEADER_OFFSET);
ut_ad(page_get_space_id(page_align(space_header)) == space->id);
......@@ -1603,22 +1602,20 @@ fsp_alloc_seg_inode_page(
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
ut_ad(rw_lock_get_sx_lock_count(&block->lock) == 1);
page = buf_block_get_frame(block);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_INODE,
mlog_write_ulint(block->frame + FIL_PAGE_TYPE, FIL_PAGE_INODE,
MLOG_2BYTES, mtr);
for (ulint i = 0; i < FSP_SEG_INODES_PER_PAGE(page_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode(
page, i, page_size, mtr);
mlog_write_ull(inode + FSEG_ID, 0, mtr);
#ifdef UNIV_DEBUG
const byte* inode = FSEG_ID + FSEG_ARR_OFFSET + block->frame;
for (ulint i = FSP_SEG_INODES_PER_PAGE(page_size); i--;
inode += FSEG_INODE_SIZE) {
ut_ad(!mach_read_from_8(inode));
}
#endif
flst_add_last(
space_header + FSP_SEG_INODES_FREE,
page + FSEG_INODE_PAGE_NODE, mtr);
block->frame + FSEG_INODE_PAGE_NODE, mtr);
return(true);
}
......@@ -2907,7 +2904,8 @@ fseg_free_page_low(
const ulint bit = offset % FSP_EXTENT_SIZE;
xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr);
xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr);
/* xdes_init() should have set all XDES_CLEAN_BIT */
ut_ad(xdes_get_bit(descr, XDES_CLEAN_BIT, bit));
if (xdes_is_free(descr, mtr)) {
/* The extent has become free: free it to space */
......
......@@ -603,16 +603,10 @@ rtr_update_mbr_field(
}
}
#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,9 +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;
ulint space;
page_cur_t* page_cursor;
lock_prdt_t prdt;
lock_prdt_t new_prdt;
......@@ -749,38 +740,19 @@ 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);
space = block->page.id.space();
const page_size_t& page_size = dict_table_page_size(index->table);
/* Update page links of the level */
if (prev_page_no != FIL_NULL) {
page_id_t prev_page_id(space, prev_page_no);
buf_block_t* prev_block = btr_block_get(
prev_page_id, page_size, RW_X_LATCH, index, 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) {
page_id_t next_page_id(space, next_page_no);
page_id_t next_page_id(block->page.id.space(),
next_page_no);
buf_block_t* next_block = btr_block_get(
next_page_id, page_size, RW_X_LATCH, index, mtr);
next_page_id, dict_table_page_size(index->table),
RW_X_LATCH, index, 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),
......@@ -788,7 +760,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);
......
......@@ -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);
......@@ -1405,7 +1405,7 @@ rtr_cur_restore_position(
/* 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;
}
......
......@@ -2980,7 +2980,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) {
......@@ -3001,7 +3001,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);
......@@ -3052,7 +3052,7 @@ ibuf_get_volume_buffered(
/* 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) {
......@@ -3073,7 +3073,7 @@ ibuf_get_volume_buffered(
}
#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);
......
......@@ -279,26 +279,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
......
......@@ -134,23 +134,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
......@@ -174,22 +157,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
......
......@@ -876,17 +876,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.
......
......@@ -919,27 +919,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 /
......
......@@ -2020,7 +2020,7 @@ row_merge_read_clustered_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;
......
......@@ -670,12 +670,12 @@ CreateIndex::operator()(mtr_t* mtr, btr_pcur_t* pcur) const
DBUG_EXECUTE_IF("ib_err_trunc_create_index", return DB_ERROR;);
if (root_page_no != FIL_NULL) {
rec_t* rec = btr_pcur_get_rec(pcur);
page_rec_write_field(
rec, DICT_FLD__SYS_INDEXES__PAGE_NO,
root_page_no, mtr);
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);
mlog_write_ulint(data, root_page_no, MLOG_4BYTES, mtr);
/* We will need to commit and restart the
mini-transaction in order to avoid deadlocks.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment