diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-11 15:03:46 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-11 15:03:46 +0200 |
commit | 3da895a736a15413d9873a16ea7ece0dd03ac0f7 (patch) | |
tree | 9318890208ff3353ddd08b6f5adf242dfa4ac07e /storage/innobase | |
parent | 74892bda3a75172f6c81d735de5bc90a4039ae33 (diff) | |
parent | 4fcfdb60e788c6c8cebe35e2e0f8d9595cc9e930 (diff) | |
download | mariadb-git-3da895a736a15413d9873a16ea7ece0dd03ac0f7.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0btr.cc | 90 | ||||
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 40 | ||||
-rw-r--r-- | storage/innobase/btr/btr0defragment.cc | 2 | ||||
-rw-r--r-- | storage/innobase/btr/btr0pcur.cc | 6 | ||||
-rw-r--r-- | storage/innobase/btr/btr0scrub.cc | 10 | ||||
-rw-r--r-- | storage/innobase/btr/btr0sea.cc | 10 | ||||
-rw-r--r-- | storage/innobase/dict/dict0boot.cc | 5 | ||||
-rw-r--r-- | storage/innobase/dict/dict0crea.cc | 13 | ||||
-rw-r--r-- | storage/innobase/fsp/fsp0fsp.cc | 28 | ||||
-rw-r--r-- | storage/innobase/gis/gis0rtree.cc | 47 | ||||
-rw-r--r-- | storage/innobase/gis/gis0sea.cc | 4 | ||||
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.cc | 8 | ||||
-rw-r--r-- | storage/innobase/include/btr0btr.h | 37 | ||||
-rw-r--r-- | storage/innobase/include/btr0btr.ic | 33 | ||||
-rw-r--r-- | storage/innobase/include/page0page.h | 11 | ||||
-rw-r--r-- | storage/innobase/include/page0page.ic | 21 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 2 |
17 files changed, 123 insertions, 244 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index ac794cc8d10..b9975bfa194 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -321,26 +321,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; } /**************************************************************//** @@ -410,10 +408,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; } @@ -2041,13 +2039,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); @@ -2549,8 +2541,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(); @@ -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), @@ -3219,8 +3211,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 */ @@ -3233,8 +3225,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, @@ -3252,8 +3244,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, @@ -3591,8 +3583,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) { @@ -3666,10 +3658,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 */ @@ -4214,8 +4206,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 ulint zip_size = index->table->space->zip_size(); ut_d(bool parent_is_different = false); @@ -4226,7 +4218,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 = @@ -4242,7 +4234,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( @@ -4883,7 +4875,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, @@ -4899,7 +4891,7 @@ btr_validate_level( zip_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); } } } @@ -4954,8 +4946,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 @@ -4972,9 +4964,7 @@ loop: 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); @@ -5055,7 +5045,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)); @@ -5196,7 +5186,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 2492988eaef..5edf91c3e68 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -270,7 +270,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) { @@ -306,10 +306,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 */ @@ -319,7 +318,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) { @@ -335,7 +334,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) { @@ -351,7 +350,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) { @@ -364,7 +363,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 */ } @@ -758,7 +757,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) { @@ -773,7 +772,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; @@ -1650,8 +1649,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) { @@ -3754,10 +3752,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; @@ -4743,7 +4738,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); @@ -4751,8 +4746,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! */ @@ -6305,7 +6299,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); @@ -7907,8 +7901,8 @@ next_zip_page: 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 diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 6a1d23fb472..f8d2026ecba 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -582,7 +582,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 a66fcc15187..2848f8d3e96 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -457,7 +457,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); @@ -484,7 +484,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 */ @@ -546,7 +546,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 3c367fb2784..8819e30f0c7 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 = 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 page_no = mach_read_from_4(page + FIL_PAGE_OFFSET); + const uint32_t left_page_no = btr_page_get_prev(page); + const uint32_t right_page_no = btr_page_get_next(page); const ulint zip_size = index->table->space->zip_size(); /** @@ -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) { diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index a220acd185c..7d1933f9486 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 ada2062dfbf..0055ca6ef17 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2018, 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 @@ -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 1a6c38a6651..1e365db12f5 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -852,11 +852,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 2a222bf5d65..bc47bb9c4e3 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1376,7 +1376,8 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, 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 = mach_read_from_4(header + FSP_FRAG_N_USED); if (state == XDES_FULL_FRAG) { @@ -1531,9 +1532,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); @@ -1548,24 +1547,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); - const ulint physical_size = space->physical_size(); - - for (ulint i = 0; i < FSP_SEG_INODES_PER_PAGE(physical_size); i++) { - - inode = fsp_seg_inode_page_get_nth_inode( - page, i, physical_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(space->physical_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); } @@ -2831,7 +2826,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 */ diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 44facb59f4b..b21440d66bc 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,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,40 +740,21 @@ 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(); ut_ad(block->zip_size() == index->table->space->zip_size()); - /* 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, block->zip_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, block->zip_size(), 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), @@ -790,7 +762,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 888cbe3e81f..a6a80542def 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); @@ -1390,7 +1390,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 a3a169f39c7..f927ab63746 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -2932,7 +2932,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) { @@ -2953,7 +2953,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); @@ -3004,7 +3004,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) { @@ -3025,7 +3025,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 283c2e0298a..3c363420da9 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -275,26 +275,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 247e25492a2..1c816ffff59 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -136,23 +136,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 @@ -176,22 +159,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/page0page.h b/storage/innobase/include/page0page.h index 0fc397cd288..6b6cee789e0 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 3507ea8830c..0992f23a7a7 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 c1f9749a71c..0e73faea5a1 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; |