Commit 5d0bab47 authored by Marko Mäkelä's avatar Marko Mäkelä

btr_block_get(), btr_block_get_func(): Change the parameter to

const dict_index_t&

btr_level_list_remove(): Clean up the parameters. Renamed from
btr_level_list_remove_func().
parent fba9883b
...@@ -226,7 +226,7 @@ btr_root_block_get( ...@@ -226,7 +226,7 @@ btr_root_block_get(
buf_block_t* block = btr_block_get( buf_block_t* block = btr_block_get(
page_id_t(index->table->space_id, index->page), page_id_t(index->table->space_id, index->page),
index->table->space->zip_size(), mode, index->table->space->zip_size(), mode,
index, mtr); *index, mtr);
if (!block) { if (!block) {
index->table->file_unreadable = true; index->table->file_unreadable = true;
...@@ -367,7 +367,7 @@ btr_root_adjust_on_import( ...@@ -367,7 +367,7 @@ btr_root_adjust_on_import(
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
block = btr_block_get(page_id, zip_size, RW_X_LATCH, index, &mtr); block = btr_block_get(page_id, zip_size, RW_X_LATCH, *index, &mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block); page_zip = buf_block_get_page_zip(block);
...@@ -830,7 +830,7 @@ btr_node_ptr_get_child( ...@@ -830,7 +830,7 @@ btr_node_ptr_get_child(
page_id_t(index->table->space_id, page_id_t(index->table->space_id,
btr_node_ptr_get_child_page_no(node_ptr, offsets)), btr_node_ptr_get_child_page_no(node_ptr, offsets)),
index->table->space->zip_size(), index->table->space->zip_size(),
RW_SX_LATCH, index, mtr); RW_SX_LATCH, *index, mtr);
} }
/************************************************************//** /************************************************************//**
...@@ -2570,12 +2570,12 @@ btr_attach_half_pages( ...@@ -2570,12 +2570,12 @@ btr_attach_half_pages(
if (prev_page_no != FIL_NULL && direction == FSP_DOWN) { if (prev_page_no != FIL_NULL && direction == FSP_DOWN) {
prev_block = btr_block_get( prev_block = btr_block_get(
page_id_t(space, prev_page_no), block->zip_size(), page_id_t(space, prev_page_no), block->zip_size(),
RW_X_LATCH, index, mtr); RW_X_LATCH, *index, mtr);
} }
if (next_page_no != FIL_NULL && direction != FSP_DOWN) { if (next_page_no != FIL_NULL && direction != FSP_DOWN) {
next_block = btr_block_get( next_block = btr_block_get(
page_id_t(space, next_page_no), block->zip_size(), page_id_t(space, next_page_no), block->zip_size(),
RW_X_LATCH, index, mtr); RW_X_LATCH, *index, mtr);
} }
/* Get the level of the split pages */ /* Get the level of the split pages */
...@@ -2725,7 +2725,7 @@ btr_insert_into_right_sibling( ...@@ -2725,7 +2725,7 @@ btr_insert_into_right_sibling(
next_block = btr_block_get( next_block = btr_block_get(
page_id_t(space, next_page_no), block->zip_size(), page_id_t(space, next_page_no), block->zip_size(),
RW_X_LATCH, cursor->index, mtr); RW_X_LATCH, *cursor->index, mtr);
next_page = buf_block_get_frame(next_block); next_page = buf_block_get_frame(next_block);
bool is_leaf = page_is_leaf(next_page); bool is_leaf = page_is_leaf(next_page);
...@@ -3244,25 +3244,18 @@ btr_page_split_and_insert( ...@@ -3244,25 +3244,18 @@ btr_page_split_and_insert(
} }
/** Remove a page from the level list of pages. /** Remove a page from the level list of pages.
@param[in] space space where removed @param[in] block page to remove
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in,out] page page to remove
@param[in] index index tree @param[in] index index tree
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
btr_level_list_remove_func(
ulint space,
ulint zip_size,
page_t* page,
dict_index_t* index,
mtr_t* mtr) mtr_t* mtr)
{ {
ut_ad(page != NULL); ut_ad(mtr_memo_contains(mtr, &block, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr != NULL); ut_ad(block.zip_size() == index.table->space->zip_size());
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(index.table->space->id == block.page.id.space());
ut_ad(space == page_get_space_id(page));
/* Get the previous and next page numbers of page */ /* 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 prev_page_no = btr_page_get_prev(page, mtr);
const ulint next_page_no = btr_page_get_next(page, mtr); const ulint next_page_no = btr_page_get_next(page, mtr);
...@@ -3270,8 +3263,10 @@ btr_level_list_remove_func( ...@@ -3270,8 +3263,10 @@ btr_level_list_remove_func(
if (prev_page_no != FIL_NULL) { if (prev_page_no != FIL_NULL) {
buf_block_t* prev_block buf_block_t* prev_block
= btr_block_get(page_id_t(space, prev_page_no), = btr_block_get(page_id_t(index.table->space->id,
zip_size, RW_X_LATCH, index, mtr); prev_page_no),
block.zip_size(), RW_X_LATCH,
index, mtr);
page_t* prev_page page_t* prev_page
= buf_block_get_frame(prev_block); = buf_block_get_frame(prev_block);
...@@ -3287,10 +3282,9 @@ btr_level_list_remove_func( ...@@ -3287,10 +3282,9 @@ btr_level_list_remove_func(
} }
if (next_page_no != FIL_NULL) { if (next_page_no != FIL_NULL) {
buf_block_t* next_block buf_block_t* next_block = btr_block_get(
= btr_block_get( page_id_t(index.table->space->id, next_page_no),
page_id_t(space, next_page_no), zip_size, block.zip_size(), RW_X_LATCH, index, mtr);
RW_X_LATCH, index, mtr);
page_t* next_page page_t* next_page
= buf_block_get_frame(next_block); = buf_block_get_frame(next_block);
...@@ -3631,8 +3625,6 @@ btr_compress( ...@@ -3631,8 +3625,6 @@ btr_compress(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
const ulint zip_size = index->table->space->zip_size();
MONITOR_INC(MONITOR_INDEX_MERGE_ATTEMPTS); MONITOR_INC(MONITOR_INDEX_MERGE_ATTEMPTS);
left_page_no = btr_page_get_prev(page, mtr); left_page_no = btr_page_get_prev(page, mtr);
...@@ -3788,8 +3780,7 @@ btr_compress( ...@@ -3788,8 +3780,7 @@ btr_compress(
btr_search_drop_page_hash_index(block); btr_search_drop_page_hash_index(block);
/* Remove the page from the level list */ /* Remove the page from the level list */
btr_level_list_remove(index->table->space_id, btr_level_list_remove(*block, *index, mtr);
zip_size, page, index, mtr);
if (dict_index_is_spatial(index)) { if (dict_index_is_spatial(index)) {
rec_t* my_rec = father_cursor.page_cur.rec; rec_t* my_rec = father_cursor.page_cur.rec;
...@@ -3918,8 +3909,7 @@ btr_compress( ...@@ -3918,8 +3909,7 @@ btr_compress(
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
/* Remove the page from the level list */ /* Remove the page from the level list */
btr_level_list_remove(index->table->space_id, btr_level_list_remove(*block, *index, mtr);
zip_size, page, index, mtr);
ut_ad(btr_node_ptr_get_child_page_no( ut_ad(btr_node_ptr_get_child_page_no(
btr_cur_get_rec(&father_cursor), offsets) btr_cur_get_rec(&father_cursor), offsets)
...@@ -4027,7 +4017,7 @@ btr_compress( ...@@ -4027,7 +4017,7 @@ btr_compress(
committed mini-transaction, because in crash recovery, committed mini-transaction, because in crash recovery,
the free bits could momentarily be set too high. */ the free bits could momentarily be set too high. */
if (zip_size) { if (merge_block->zip_size()) {
/* Because the free bits may be incremented /* Because the free bits may be incremented
and we cannot update the insert buffer bitmap and we cannot update the insert buffer bitmap
in the same mini-transaction, the only safe in the same mini-transaction, the only safe
...@@ -4087,9 +4077,8 @@ btr_compress( ...@@ -4087,9 +4077,8 @@ btr_compress(
err_exit: err_exit:
/* We play it safe and reset the free bits. */ /* We play it safe and reset the free bits. */
if (zip_size if (merge_block && merge_block->zip_size()
&& merge_page && page_is_leaf(merge_block->frame)
&& page_is_leaf(merge_page)
&& !dict_index_is_clust(index)) { && !dict_index_is_clust(index)) {
ibuf_reset_free_bits(merge_block); ibuf_reset_free_bits(merge_block);
...@@ -4266,7 +4255,7 @@ btr_discard_page( ...@@ -4266,7 +4255,7 @@ btr_discard_page(
if (left_page_no != FIL_NULL) { if (left_page_no != FIL_NULL) {
merge_block = btr_block_get( merge_block = btr_block_get(
page_id_t(index->table->space_id, left_page_no), page_id_t(index->table->space_id, left_page_no),
zip_size, RW_X_LATCH, index, mtr); zip_size, RW_X_LATCH, *index, mtr);
merge_page = buf_block_get_frame(merge_block); merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
...@@ -4282,7 +4271,7 @@ btr_discard_page( ...@@ -4282,7 +4271,7 @@ btr_discard_page(
} else if (right_page_no != FIL_NULL) { } else if (right_page_no != FIL_NULL) {
merge_block = btr_block_get( merge_block = btr_block_get(
page_id_t(index->table->space_id, right_page_no), page_id_t(index->table->space_id, right_page_no),
zip_size, RW_X_LATCH, index, mtr); zip_size, RW_X_LATCH, *index, mtr);
merge_page = buf_block_get_frame(merge_block); merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
...@@ -4324,8 +4313,7 @@ btr_discard_page( ...@@ -4324,8 +4313,7 @@ btr_discard_page(
} }
/* Remove the page from the level list */ /* Remove the page from the level list */
btr_level_list_remove(index->table->space_id, zip_size, btr_level_list_remove(*block, *index, mtr);
page, index, mtr);
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
{ {
...@@ -4941,7 +4929,7 @@ btr_validate_level( ...@@ -4941,7 +4929,7 @@ btr_validate_level(
page_id_t(index->table->space_id, page_id_t(index->table->space_id,
left_page_no), left_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
left_page_no = btr_page_get_prev(page, &mtr); left_page_no = btr_page_get_prev(page, &mtr);
} }
...@@ -5012,7 +5000,7 @@ btr_validate_level( ...@@ -5012,7 +5000,7 @@ btr_validate_level(
right_block = btr_block_get( right_block = btr_block_get(
page_id_t(index->table->space_id, right_page_no), page_id_t(index->table->space_id, right_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
right_page = buf_block_get_frame(right_block); right_page = buf_block_get_frame(right_block);
...@@ -5190,13 +5178,13 @@ btr_validate_level( ...@@ -5190,13 +5178,13 @@ btr_validate_level(
page_id_t(index->table->space_id, page_id_t(index->table->space_id,
parent_right_page_no), parent_right_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
right_block = btr_block_get( right_block = btr_block_get(
page_id_t(index->table->space_id, page_id_t(index->table->space_id,
right_page_no), right_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
} }
btr_cur_position( btr_cur_position(
...@@ -5274,21 +5262,21 @@ btr_validate_level( ...@@ -5274,21 +5262,21 @@ btr_validate_level(
index->table->space_id, index->table->space_id,
parent_right_page_no), parent_right_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
} }
} else if (parent_page_no != FIL_NULL) { } else if (parent_page_no != FIL_NULL) {
btr_block_get( btr_block_get(
page_id_t(index->table->space_id, page_id_t(index->table->space_id,
parent_page_no), parent_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
} }
} }
block = btr_block_get( block = btr_block_get(
page_id_t(index->table->space_id, right_page_no), page_id_t(index->table->space_id, right_page_no),
zip_size, zip_size,
RW_SX_LATCH, index, &mtr); RW_SX_LATCH, *index, &mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
...@@ -5395,7 +5383,7 @@ btr_can_merge_with_page( ...@@ -5395,7 +5383,7 @@ btr_can_merge_with_page(
const page_id_t page_id(index->table->space_id, page_no); const page_id_t page_id(index->table->space_id, page_no);
const ulint zip_size = index->table->space->zip_size(); const ulint zip_size = index->table->space->zip_size();
mblock = btr_block_get(page_id, zip_size, RW_X_LATCH, index, mtr); mblock = btr_block_get(page_id, zip_size, RW_X_LATCH, *index, mtr);
mpage = buf_block_get_frame(mblock); mpage = buf_block_get_frame(mblock);
n_recs = page_get_n_recs(page); n_recs = page_get_n_recs(page);
......
...@@ -122,7 +122,7 @@ PageBulk::init() ...@@ -122,7 +122,7 @@ PageBulk::init()
new_block = btr_block_get( new_block = btr_block_get(
page_id_t(m_index->table->space_id, m_page_no), page_id_t(m_index->table->space_id, m_page_no),
m_index->table->space->zip_size(), m_index->table->space->zip_size(),
RW_X_LATCH, m_index, &m_mtr); RW_X_LATCH, *m_index, &m_mtr);
new_page = buf_block_get_frame(new_block); new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block); new_page_zip = buf_block_get_page_zip(new_block);
...@@ -1018,7 +1018,7 @@ BtrBulk::finish(dberr_t err) ...@@ -1018,7 +1018,7 @@ BtrBulk::finish(dberr_t err)
last_block = btr_block_get( last_block = btr_block_get(
page_id_t(m_index->table->space_id, last_page_no), page_id_t(m_index->table->space_id, last_page_no),
m_index->table->space->zip_size(), m_index->table->space->zip_size(),
RW_X_LATCH, m_index, &mtr); RW_X_LATCH, *m_index, &mtr);
first_rec = page_rec_get_next( first_rec = page_rec_get_next(
page_get_infimum_rec(last_block->frame)); page_get_infimum_rec(last_block->frame));
ut_ad(page_rec_is_user_rec(first_rec)); ut_ad(page_rec_is_user_rec(first_rec));
......
...@@ -251,7 +251,7 @@ btr_cur_latch_leaves( ...@@ -251,7 +251,7 @@ btr_cur_latch_leaves(
mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH; mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH;
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
get_block = btr_block_get(page_id, zip_size, mode, get_block = btr_block_get(page_id, zip_size, mode,
cursor->index, mtr); *cursor->index, mtr);
latch_leaves.blocks[1] = get_block; latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
...@@ -283,7 +283,7 @@ btr_cur_latch_leaves( ...@@ -283,7 +283,7 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr); latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
get_block = btr_block_get( get_block = btr_block_get(
page_id_t(page_id.space(), left_page_no), page_id_t(page_id.space(), left_page_no),
zip_size, RW_X_LATCH, cursor->index, mtr); zip_size, RW_X_LATCH, *cursor->index, mtr);
latch_leaves.blocks[0] = get_block; latch_leaves.blocks[0] = get_block;
if (spatial) { if (spatial) {
...@@ -299,7 +299,7 @@ btr_cur_latch_leaves( ...@@ -299,7 +299,7 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
get_block = btr_block_get( get_block = btr_block_get(
page_id, zip_size, RW_X_LATCH, cursor->index, mtr); page_id, zip_size, RW_X_LATCH, *cursor->index, mtr);
latch_leaves.blocks[1] = get_block; latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
...@@ -330,7 +330,7 @@ btr_cur_latch_leaves( ...@@ -330,7 +330,7 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[2] = mtr_set_savepoint(mtr); latch_leaves.savepoints[2] = mtr_set_savepoint(mtr);
get_block = btr_block_get( get_block = btr_block_get(
page_id_t(page_id.space(), right_page_no), page_id_t(page_id.space(), right_page_no),
zip_size, RW_X_LATCH, cursor->index, mtr); zip_size, RW_X_LATCH, *cursor->index, mtr);
latch_leaves.blocks[2] = get_block; latch_leaves.blocks[2] = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) ut_a(page_is_comp(get_block->frame)
...@@ -358,7 +358,7 @@ btr_cur_latch_leaves( ...@@ -358,7 +358,7 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr); latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
get_block = btr_block_get( get_block = btr_block_get(
page_id_t(page_id.space(), left_page_no), page_id_t(page_id.space(), left_page_no),
zip_size, mode, cursor->index, mtr); zip_size, mode, *cursor->index, mtr);
latch_leaves.blocks[0] = get_block; latch_leaves.blocks[0] = get_block;
cursor->left_block = get_block; cursor->left_block = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
...@@ -371,7 +371,7 @@ btr_cur_latch_leaves( ...@@ -371,7 +371,7 @@ btr_cur_latch_leaves(
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr); latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
get_block = btr_block_get(page_id, zip_size, mode, get_block = btr_block_get(page_id, zip_size, mode,
cursor->index, mtr); *cursor->index, mtr);
latch_leaves.blocks[1] = get_block; latch_leaves.blocks[1] = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
...@@ -766,7 +766,7 @@ btr_cur_optimistic_latch_leaves( ...@@ -766,7 +766,7 @@ btr_cur_optimistic_latch_leaves(
page_id_t(cursor->index->table->space_id, page_id_t(cursor->index->table->space_id,
left_page_no), left_page_no),
cursor->index->table->space->zip_size(), cursor->index->table->space->zip_size(),
mode, cursor->index, mtr); mode, *cursor->index, mtr);
} else { } else {
cursor->left_block = NULL; cursor->left_block = NULL;
} }
...@@ -2352,12 +2352,12 @@ btr_cur_search_to_nth_level_func( ...@@ -2352,12 +2352,12 @@ btr_cur_search_to_nth_level_func(
if (latch_mode == BTR_CONT_MODIFY_TREE) { if (latch_mode == BTR_CONT_MODIFY_TREE) {
child_block = btr_block_get( child_block = btr_block_get(
page_id, zip_size, RW_X_LATCH, page_id, zip_size, RW_X_LATCH,
index, mtr); *index, mtr);
} else { } else {
ut_ad(latch_mode == BTR_CONT_SEARCH_TREE); ut_ad(latch_mode == BTR_CONT_SEARCH_TREE);
child_block = btr_block_get( child_block = btr_block_get(
page_id, zip_size, RW_SX_LATCH, page_id, zip_size, RW_SX_LATCH,
index, mtr); *index, mtr);
} }
btr_assert_not_corrupted(child_block, index); btr_assert_not_corrupted(child_block, index);
...@@ -7476,7 +7476,7 @@ struct btr_blob_log_check_t { ...@@ -7476,7 +7476,7 @@ struct btr_blob_log_check_t {
m_pcur->btr_cur.page_cur.block = btr_block_get( m_pcur->btr_cur.page_cur.block = btr_block_get(
page_id_t(index->table->space_id, page_no), page_id_t(index->table->space_id, page_no),
index->table->space->zip_size(), index->table->space->zip_size(),
RW_X_LATCH, index, m_mtr); RW_X_LATCH, *index, m_mtr);
m_pcur->btr_cur.page_cur.rec m_pcur->btr_cur.page_cur.rec
= m_pcur->btr_cur.page_cur.block->frame = m_pcur->btr_cur.page_cur.block->frame
+ offs; + offs;
......
...@@ -166,7 +166,7 @@ btr_defragment_add_index( ...@@ -166,7 +166,7 @@ btr_defragment_add_index(
buf_block_t* block = btr_block_get( buf_block_t* block = btr_block_get(
page_id_t(index->table->space_id, index->page), page_id_t(index->table->space_id, index->page),
index->table->space->zip_size(), index->table->space->zip_size(),
RW_NO_LATCH, index, &mtr); RW_NO_LATCH, *index, &mtr);
page_t* page = NULL; page_t* page = NULL;
if (block) { if (block) {
...@@ -487,9 +487,7 @@ btr_defragment_merge_pages( ...@@ -487,9 +487,7 @@ btr_defragment_merge_pages(
lock_update_merge_left(to_block, orig_pred, lock_update_merge_left(to_block, orig_pred,
from_block); from_block);
btr_search_drop_page_hash_index(from_block); btr_search_drop_page_hash_index(from_block);
btr_level_list_remove( btr_level_list_remove(*from_block, *index, mtr);
index->table->space_id,
zip_size, from_page, index, mtr);
btr_page_get_father(index, from_block, mtr, &parent); btr_page_get_father(index, from_block, mtr, &parent);
btr_cur_node_ptr_delete(&parent, mtr); btr_cur_node_ptr_delete(&parent, mtr);
/* btr_blob_dbg_remove(from_page, index, /* btr_blob_dbg_remove(from_page, index,
...@@ -593,7 +591,7 @@ btr_defragment_n_pages( ...@@ -593,7 +591,7 @@ btr_defragment_n_pages(
blocks[i] = btr_block_get(page_id_t(index->table->space_id, blocks[i] = btr_block_get(page_id_t(index->table->space_id,
page_no), zip_size, page_no), zip_size,
RW_X_LATCH, index, mtr); RW_X_LATCH, *index, mtr);
} }
if (n_pages == 1) { if (n_pages == 1) {
......
...@@ -475,7 +475,7 @@ btr_pcur_move_to_next_page( ...@@ -475,7 +475,7 @@ btr_pcur_move_to_next_page(
next_block = btr_block_get( next_block = btr_block_get(
page_id_t(block->page.id.space(), next_page_no), page_id_t(block->page.id.space(), next_page_no),
block->zip_size(), mode, block->zip_size(), mode,
btr_pcur_get_btr_cur(cursor)->index, mtr); *btr_pcur_get_btr_cur(cursor)->index, mtr);
if (UNIV_UNLIKELY(!next_block)) { if (UNIV_UNLIKELY(!next_block)) {
return; return;
......
...@@ -451,14 +451,14 @@ btr_pessimistic_scrub( ...@@ -451,14 +451,14 @@ btr_pessimistic_scrub(
btr_block_get( btr_block_get(
page_id_t(index->table->space_id, left_page_no), page_id_t(index->table->space_id, left_page_no),
zip_size, RW_X_LATCH, index, mtr); zip_size, RW_X_LATCH, *index, mtr);
/** /**
* Refetch block and re-initialize page * Refetch block and re-initialize page
*/ */
block = btr_block_get( block = btr_block_get(
page_id_t(index->table->space_id, page_no), page_id_t(index->table->space_id, page_no),
zip_size, RW_X_LATCH, index, mtr); zip_size, RW_X_LATCH, *index, mtr);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
...@@ -472,7 +472,7 @@ btr_pessimistic_scrub( ...@@ -472,7 +472,7 @@ btr_pessimistic_scrub(
if (right_page_no != FIL_NULL) { if (right_page_no != FIL_NULL) {
btr_block_get( btr_block_get(
page_id_t(index->table->space_id, right_page_no), page_id_t(index->table->space_id, right_page_no),
zip_size, RW_X_LATCH, index, mtr); zip_size, RW_X_LATCH, *index, mtr);
} }
/* arguments to btr_page_split_and_insert */ /* arguments to btr_page_split_and_insert */
......
...@@ -761,7 +761,7 @@ rtr_adjust_upper_level( ...@@ -761,7 +761,7 @@ rtr_adjust_upper_level(
buf_block_t* prev_block = btr_block_get( buf_block_t* prev_block = btr_block_get(
prev_page_id, block->zip_size(), RW_X_LATCH, prev_page_id, block->zip_size(), RW_X_LATCH,
index, mtr); *index, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(prev_block->frame) == page_is_comp(page)); 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, mtr)
...@@ -778,7 +778,7 @@ rtr_adjust_upper_level( ...@@ -778,7 +778,7 @@ rtr_adjust_upper_level(
buf_block_t* next_block = btr_block_get( buf_block_t* next_block = btr_block_get(
next_page_id, block->zip_size(), RW_X_LATCH, next_page_id, block->zip_size(), RW_X_LATCH,
index, mtr); *index, mtr);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_block->frame) == page_is_comp(page)); 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, mtr)
...@@ -1882,7 +1882,7 @@ rtr_estimate_n_rows_in_range( ...@@ -1882,7 +1882,7 @@ rtr_estimate_n_rows_in_range(
buf_block_t* block = btr_block_get( buf_block_t* block = btr_block_get(
page_id_t(index->table->space_id, index->page), page_id_t(index->table->space_id, index->page),
index->table->space->zip_size(), index->table->space->zip_size(),
RW_S_LATCH, index, &mtr); RW_S_LATCH, *index, &mtr);
const page_t* page = buf_block_get_frame(block); const page_t* page = buf_block_get_frame(block);
const unsigned n_recs = page_header_get_field(page, PAGE_N_RECS); const unsigned n_recs = page_header_get_field(page, PAGE_N_RECS);
......
...@@ -223,8 +223,7 @@ btr_height_get( ...@@ -223,8 +223,7 @@ btr_height_get(
@param[in] mode latch mode @param[in] mode latch mode
@param[in] file file name @param[in] file file name
@param[in] line line where called @param[in] line line where called
@param[in] index index tree, may be NULL if it is not an insert buffer @param[in] index index tree
tree
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return block */ @return block */
UNIV_INLINE UNIV_INLINE
...@@ -235,19 +234,19 @@ btr_block_get_func( ...@@ -235,19 +234,19 @@ btr_block_get_func(
ulint mode, ulint mode,
const char* file, const char* file,
unsigned line, unsigned line,
dict_index_t* index, const dict_index_t& index,
mtr_t* mtr); mtr_t* mtr);
/** Gets a buffer page and declares its latching order level. /** Gets a buffer page and declares its latching order level.
@param page_id tablespace/page identifier @param page_id tablespace/page identifier
@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param mode latch mode @param mode latch mode
@param index index tree, may be NULL if not the insert buffer tree @param index index tree
@param mtr mini-transaction handle @param mtr mini-transaction handle
@return the block descriptor */ @return the block descriptor */
# define btr_block_get(page_id, zip_size, mode, index, mtr) \ # define btr_block_get(page_id, zip_size, mode, index, mtr) \
btr_block_get_func(page_id, zip_size, mode, \ btr_block_get_func(page_id, zip_size, mode, \
__FILE__, __LINE__, (dict_index_t*)index, mtr) __FILE__, __LINE__, index, mtr)
/**************************************************************//** /**************************************************************//**
Gets the index id field of a page. Gets the index id field of a page.
@return index id */ @return index id */
...@@ -763,29 +762,12 @@ btr_validate_index( ...@@ -763,29 +762,12 @@ btr_validate_index(
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/** Remove a page from the level list of pages. /** Remove a page from the level list of pages.
@param[in] space space where removed @param[in] block page to remove
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in,out] page page to remove
@param[in] index index tree @param[in] index index tree
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
btr_level_list_remove_func(
ulint space,
ulint zip_size,
page_t* page,
dict_index_t* index,
mtr_t* mtr); mtr_t* mtr);
/*************************************************************//**
Removes a page from the level list of pages.
@param space in: space where removed
@param zip_size in: compressed page size in bytes, or 0 for uncompressed
@param page in/out: page to remove
@param index in: index tree
@param mtr in/out: mini-transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
btr_level_list_remove_func(space,zip_size,page,index,mtr)
/*************************************************************//** /*************************************************************//**
If page is the only on its level, this function moves its records to the If page is the only on its level, this function moves its records to the
father page, thus reducing the tree height. father page, thus reducing the tree height.
......
...@@ -47,7 +47,7 @@ btr_block_get_func( ...@@ -47,7 +47,7 @@ btr_block_get_func(
ulint mode, ulint mode,
const char* file, const char* file,
unsigned line, unsigned line,
dict_index_t* index, const dict_index_t& index,
mtr_t* mtr) mtr_t* mtr)
{ {
buf_block_t* block; buf_block_t* block;
...@@ -57,21 +57,18 @@ btr_block_get_func( ...@@ -57,21 +57,18 @@ btr_block_get_func(
page_id, zip_size, mode, NULL, BUF_GET, file, line, mtr, &err); page_id, zip_size, mode, NULL, BUF_GET, file, line, mtr, &err);
if (err == DB_DECRYPTION_FAILED) { if (err == DB_DECRYPTION_FAILED) {
if (index && index->table) { if (index.table) {
index->table->file_unreadable = true; index.table->file_unreadable = true;
} }
} }
if (block) { if (block && mode != RW_NO_LATCH) {
if (mode != RW_NO_LATCH) { buf_block_dbg_add_level(block, index.is_ibuf()
? SYNC_IBUF_TREE_NODE
buf_block_dbg_add_level( : SYNC_TREE_NODE);
block, index != NULL && dict_index_is_ibuf(index)
? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
}
} }
return(block); return block;
} }
/**************************************************************//** /**************************************************************//**
......
...@@ -437,9 +437,9 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size); ...@@ -437,9 +437,9 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size);
@param[in] guess guessed block or NULL @param[in] guess guessed block or NULL
@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[in] file file name @param[in] file file name of caller
@param[in] line line where called @param[in] line line number of caller
@param[in] mtr mini-transaction @param[in,out] mtr mini-transaction
@param[out] err DB_SUCCESS or error code @param[out] err DB_SUCCESS or error code
@return pointer to the block or NULL */ @return pointer to the block or NULL */
buf_block_t* buf_block_t*
......
...@@ -2032,7 +2032,7 @@ row_merge_read_clustered_index( ...@@ -2032,7 +2032,7 @@ row_merge_read_clustered_index(
next_page_no), next_page_no),
block->zip_size(), block->zip_size(),
BTR_SEARCH_LEAF, BTR_SEARCH_LEAF,
clust_index, &mtr); *clust_index, &mtr);
btr_leaf_page_release(page_cur_get_block(cur), btr_leaf_page_release(page_cur_get_block(cur),
BTR_SEARCH_LEAF, &mtr); BTR_SEARCH_LEAF, &mtr);
......
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