mirror of
https://github.com/MariaDB/server.git
synced 2026-05-11 09:30:23 +02:00
btr_block_get(): Remove redundant parameters
This commit is contained in:
parent
5d0bab47fc
commit
a340af9223
13 changed files with 149 additions and 278 deletions
|
|
@ -215,7 +215,7 @@ buf_block_t*
|
|||
btr_root_block_get(
|
||||
/*===============*/
|
||||
const dict_index_t* index, /*!< in: index tree */
|
||||
ulint mode, /*!< in: either RW_S_LATCH
|
||||
rw_lock_type_t mode, /*!< in: either RW_S_LATCH
|
||||
or RW_X_LATCH */
|
||||
mtr_t* mtr) /*!< in: mtr */
|
||||
{
|
||||
|
|
@ -223,10 +223,7 @@ btr_root_block_get(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
buf_block_t* block = btr_block_get(
|
||||
page_id_t(index->table->space_id, index->page),
|
||||
index->table->space->zip_size(), mode,
|
||||
*index, mtr);
|
||||
buf_block_t* block = btr_block_get(*index, index->page, mode, mtr);
|
||||
|
||||
if (!block) {
|
||||
index->table->file_unreadable = true;
|
||||
|
|
@ -354,11 +351,8 @@ btr_root_adjust_on_import(
|
|||
dberr_t err;
|
||||
mtr_t mtr;
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
page_zip_des_t* page_zip;
|
||||
dict_table_t* table = index->table;
|
||||
const page_id_t page_id(table->space_id, index->page);
|
||||
const ulint zip_size = table->space->zip_size();
|
||||
|
||||
DBUG_EXECUTE_IF("ib_import_trigger_corruption_3",
|
||||
return(DB_CORRUPTION););
|
||||
|
|
@ -367,7 +361,17 @@ btr_root_adjust_on_import(
|
|||
|
||||
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
||||
|
||||
block = btr_block_get(page_id, zip_size, RW_X_LATCH, *index, &mtr);
|
||||
buf_block_t* block = buf_page_get_gen(
|
||||
page_id_t(table->space->id, index->page),
|
||||
table->space->zip_size(), RW_X_LATCH, NULL, BUF_GET,
|
||||
__FILE__, __LINE__,
|
||||
&mtr, &err);
|
||||
if (!block) {
|
||||
ut_ad(err != DB_SUCCESS);
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
|
@ -418,6 +422,7 @@ btr_root_adjust_on_import(
|
|||
err = DB_CORRUPTION;
|
||||
}
|
||||
|
||||
func_exit:
|
||||
mtr_commit(&mtr);
|
||||
|
||||
return(err);
|
||||
|
|
@ -827,10 +832,8 @@ btr_node_ptr_get_child(
|
|||
== page_get_space_id(page_align(node_ptr)));
|
||||
|
||||
return btr_block_get(
|
||||
page_id_t(index->table->space_id,
|
||||
btr_node_ptr_get_child_page_no(node_ptr, offsets)),
|
||||
index->table->space->zip_size(),
|
||||
RW_SX_LATCH, *index, mtr);
|
||||
*index, btr_node_ptr_get_child_page_no(node_ptr, offsets),
|
||||
RW_SX_LATCH, mtr);
|
||||
}
|
||||
|
||||
/************************************************************//**
|
||||
|
|
@ -2564,18 +2567,14 @@ btr_attach_half_pages(
|
|||
prev_page_no = btr_page_get_prev(page, mtr);
|
||||
next_page_no = btr_page_get_next(page, mtr);
|
||||
|
||||
const ulint space = block->page.id.space();
|
||||
|
||||
/* for consistency, both blocks should be locked, before change */
|
||||
if (prev_page_no != FIL_NULL && direction == FSP_DOWN) {
|
||||
prev_block = btr_block_get(
|
||||
page_id_t(space, prev_page_no), block->zip_size(),
|
||||
RW_X_LATCH, *index, mtr);
|
||||
prev_block = btr_block_get(*index, prev_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
}
|
||||
if (next_page_no != FIL_NULL && direction != FSP_DOWN) {
|
||||
next_block = btr_block_get(
|
||||
page_id_t(space, next_page_no), block->zip_size(),
|
||||
RW_X_LATCH, *index, mtr);
|
||||
next_block = btr_block_get(*index, next_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
}
|
||||
|
||||
/* Get the level of the split pages */
|
||||
|
|
@ -2721,11 +2720,11 @@ btr_insert_into_right_sibling(
|
|||
rec_t* rec = NULL;
|
||||
ulint max_size;
|
||||
|
||||
const ulint space = block->page.id.space();
|
||||
|
||||
next_block = btr_block_get(
|
||||
page_id_t(space, next_page_no), block->zip_size(),
|
||||
RW_X_LATCH, *cursor->index, mtr);
|
||||
next_block = btr_block_get(*cursor->index, next_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
if (UNIV_UNLIKELY(!next_block)) {
|
||||
return NULL;
|
||||
}
|
||||
next_page = buf_block_get_frame(next_block);
|
||||
|
||||
bool is_leaf = page_is_leaf(next_page);
|
||||
|
|
@ -3262,12 +3261,8 @@ void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
|
|||
/* Update page links of the level */
|
||||
|
||||
if (prev_page_no != FIL_NULL) {
|
||||
buf_block_t* prev_block
|
||||
= btr_block_get(page_id_t(index.table->space->id,
|
||||
prev_page_no),
|
||||
block.zip_size(), RW_X_LATCH,
|
||||
index, mtr);
|
||||
|
||||
buf_block_t* prev_block = btr_block_get(
|
||||
index, prev_page_no, RW_X_LATCH, mtr);
|
||||
page_t* prev_page
|
||||
= buf_block_get_frame(prev_block);
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
|
|
@ -3283,9 +3278,7 @@ void btr_level_list_remove(const buf_block_t& block, const dict_index_t& index,
|
|||
|
||||
if (next_page_no != FIL_NULL) {
|
||||
buf_block_t* next_block = btr_block_get(
|
||||
page_id_t(index.table->space->id, next_page_no),
|
||||
block.zip_size(), RW_X_LATCH, index, mtr);
|
||||
|
||||
index, next_page_no, RW_X_LATCH, mtr);
|
||||
page_t* next_page
|
||||
= buf_block_get_frame(next_block);
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
|
|
@ -4250,13 +4243,10 @@ btr_discard_page(
|
|||
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);
|
||||
|
||||
const ulint zip_size = index->table->space->zip_size();
|
||||
ut_d(bool parent_is_different = false);
|
||||
if (left_page_no != FIL_NULL) {
|
||||
merge_block = btr_block_get(
|
||||
page_id_t(index->table->space_id, left_page_no),
|
||||
zip_size, RW_X_LATCH, *index, mtr);
|
||||
|
||||
merge_block = btr_block_get(*index, left_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
merge_page = buf_block_get_frame(merge_block);
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_next(merge_page, mtr)
|
||||
|
|
@ -4269,10 +4259,8 @@ btr_discard_page(
|
|||
&parent_cursor)))
|
||||
== btr_cur_get_rec(&parent_cursor)));
|
||||
} else if (right_page_no != FIL_NULL) {
|
||||
merge_block = btr_block_get(
|
||||
page_id_t(index->table->space_id, right_page_no),
|
||||
zip_size, RW_X_LATCH, *index, mtr);
|
||||
|
||||
merge_block = btr_block_get(*index, right_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
merge_page = buf_block_get_frame(merge_block);
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_prev(merge_page, mtr)
|
||||
|
|
@ -4875,7 +4863,6 @@ btr_validate_level(
|
|||
page = buf_block_get_frame(block);
|
||||
|
||||
fil_space_t* space = index->table->space;
|
||||
const ulint zip_size = space->zip_size();
|
||||
|
||||
while (level != btr_page_get_level(page)) {
|
||||
const rec_t* node_ptr;
|
||||
|
|
@ -4925,11 +4912,8 @@ btr_validate_level(
|
|||
&mtr, savepoint2, block);
|
||||
|
||||
savepoint2 = mtr_set_savepoint(&mtr);
|
||||
block = btr_block_get(
|
||||
page_id_t(index->table->space_id,
|
||||
left_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
block = btr_block_get(*index, left_page_no,
|
||||
RW_SX_LATCH, &mtr);
|
||||
page = buf_block_get_frame(block);
|
||||
left_page_no = btr_page_get_prev(page, &mtr);
|
||||
}
|
||||
|
|
@ -4997,11 +4981,8 @@ loop:
|
|||
const rec_t* right_rec;
|
||||
savepoint = mtr_set_savepoint(&mtr);
|
||||
|
||||
right_block = btr_block_get(
|
||||
page_id_t(index->table->space_id, right_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
|
||||
right_block = btr_block_get(*index, right_page_no, RW_SX_LATCH,
|
||||
&mtr);
|
||||
right_page = buf_block_get_frame(right_block);
|
||||
|
||||
if (btr_page_get_prev(right_page, &mtr)
|
||||
|
|
@ -5174,17 +5155,11 @@ loop:
|
|||
mtr_release_block_at_savepoint(
|
||||
&mtr, savepoint, right_block);
|
||||
|
||||
btr_block_get(
|
||||
page_id_t(index->table->space_id,
|
||||
parent_right_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
|
||||
right_block = btr_block_get(
|
||||
page_id_t(index->table->space_id,
|
||||
right_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
btr_block_get(*index, parent_right_page_no,
|
||||
RW_SX_LATCH, &mtr);
|
||||
right_block = btr_block_get(*index,
|
||||
right_page_no,
|
||||
RW_SX_LATCH, &mtr);
|
||||
}
|
||||
|
||||
btr_cur_position(
|
||||
|
|
@ -5257,27 +5232,18 @@ node_ptr_fails:
|
|||
if (!lockout) {
|
||||
if (rightmost_child) {
|
||||
if (parent_right_page_no != FIL_NULL) {
|
||||
btr_block_get(
|
||||
page_id_t(
|
||||
index->table->space_id,
|
||||
parent_right_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
btr_block_get(*index,
|
||||
parent_right_page_no,
|
||||
RW_SX_LATCH, &mtr);
|
||||
}
|
||||
} else if (parent_page_no != FIL_NULL) {
|
||||
btr_block_get(
|
||||
page_id_t(index->table->space_id,
|
||||
parent_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
btr_block_get(*index, parent_page_no,
|
||||
RW_SX_LATCH, &mtr);
|
||||
}
|
||||
}
|
||||
|
||||
block = btr_block_get(
|
||||
page_id_t(index->table->space_id, right_page_no),
|
||||
zip_size,
|
||||
RW_SX_LATCH, *index, &mtr);
|
||||
|
||||
block = btr_block_get(*index, right_page_no, RW_SX_LATCH,
|
||||
&mtr);
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
goto loop;
|
||||
|
|
@ -5380,10 +5346,7 @@ btr_can_merge_with_page(
|
|||
index = btr_cur_get_index(cursor);
|
||||
page = btr_cur_get_page(cursor);
|
||||
|
||||
const page_id_t page_id(index->table->space_id, page_no);
|
||||
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(*index, page_no, RW_X_LATCH, mtr);
|
||||
mpage = buf_block_get_frame(mblock);
|
||||
|
||||
n_recs = page_get_n_recs(page);
|
||||
|
|
@ -5399,7 +5362,7 @@ btr_can_merge_with_page(
|
|||
/* If compression padding tells us that merging will result in
|
||||
too packed up page i.e.: which is likely to cause compression
|
||||
failure then don't merge the pages. */
|
||||
if (zip_size && page_is_leaf(mpage)
|
||||
if (mblock->page.zip.data && page_is_leaf(mpage)
|
||||
&& (page_get_data_size(mpage) + data_size
|
||||
>= dict_index_zip_pad_optimal_page_size(index))) {
|
||||
|
||||
|
|
|
|||
|
|
@ -119,10 +119,8 @@ PageBulk::init()
|
|||
m_index->id, &m_mtr);
|
||||
}
|
||||
} else {
|
||||
new_block = btr_block_get(
|
||||
page_id_t(m_index->table->space_id, m_page_no),
|
||||
m_index->table->space->zip_size(),
|
||||
RW_X_LATCH, *m_index, &m_mtr);
|
||||
new_block = btr_block_get(*m_index, m_page_no, RW_X_LATCH,
|
||||
&m_mtr);
|
||||
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
new_page_zip = buf_block_get_page_zip(new_block);
|
||||
|
|
@ -1015,10 +1013,8 @@ BtrBulk::finish(dberr_t err)
|
|||
mtr_x_lock(&m_index->lock, &mtr);
|
||||
|
||||
ut_ad(last_page_no != FIL_NULL);
|
||||
last_block = btr_block_get(
|
||||
page_id_t(m_index->table->space_id, last_page_no),
|
||||
m_index->table->space->zip_size(),
|
||||
RW_X_LATCH, *m_index, &mtr);
|
||||
last_block = btr_block_get(*m_index, last_page_no, RW_X_LATCH,
|
||||
&mtr);
|
||||
first_rec = page_rec_get_next(
|
||||
page_get_infimum_rec(last_block->frame));
|
||||
ut_ad(page_rec_is_user_rec(first_rec));
|
||||
|
|
|
|||
|
|
@ -209,8 +209,6 @@ btr_rec_free_externally_stored_fields(
|
|||
|
||||
/** Latches the leaf page or pages requested.
|
||||
@param[in] block leaf page where the search converged
|
||||
@param[in] page_id page id of the leaf
|
||||
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
|
||||
@param[in] latch_mode BTR_SEARCH_LEAF, ...
|
||||
@param[in] cursor cursor
|
||||
@param[in] mtr mini-transaction
|
||||
|
|
@ -218,13 +216,11 @@ btr_rec_free_externally_stored_fields(
|
|||
btr_latch_leaves_t
|
||||
btr_cur_latch_leaves(
|
||||
buf_block_t* block,
|
||||
const page_id_t page_id,
|
||||
ulint zip_size,
|
||||
ulint latch_mode,
|
||||
btr_cur_t* cursor,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
ulint mode;
|
||||
rw_lock_type_t mode;
|
||||
ulint left_page_no;
|
||||
ulint right_page_no;
|
||||
buf_block_t* get_block;
|
||||
|
|
@ -235,6 +231,7 @@ btr_cur_latch_leaves(
|
|||
compile_time_assert(int(MTR_MEMO_PAGE_S_FIX) == int(RW_S_LATCH));
|
||||
compile_time_assert(int(MTR_MEMO_PAGE_X_FIX) == int(RW_X_LATCH));
|
||||
compile_time_assert(int(MTR_MEMO_PAGE_SX_FIX) == int(RW_SX_LATCH));
|
||||
ut_ad(block->page.id.space() == cursor->index->table->space->id);
|
||||
|
||||
spatial = dict_index_is_spatial(cursor->index) && cursor->rtr_info;
|
||||
ut_ad(buf_page_in_file(&block->page));
|
||||
|
|
@ -250,8 +247,8 @@ btr_cur_latch_leaves(
|
|||
|
||||
mode = latch_mode == BTR_MODIFY_LEAF ? RW_X_LATCH : RW_S_LATCH;
|
||||
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(page_id, zip_size, mode,
|
||||
*cursor->index, mtr);
|
||||
get_block = btr_block_get(*cursor->index,
|
||||
block->page.id.page_no(), mode, mtr);
|
||||
latch_leaves.blocks[1] = get_block;
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
|
||||
|
|
@ -271,7 +268,6 @@ btr_cur_latch_leaves(
|
|||
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);
|
||||
mode = latch_mode;
|
||||
|
||||
if (left_page_no != FIL_NULL) {
|
||||
|
||||
|
|
@ -282,8 +278,7 @@ btr_cur_latch_leaves(
|
|||
|
||||
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(
|
||||
page_id_t(page_id.space(), left_page_no),
|
||||
zip_size, RW_X_LATCH, *cursor->index, mtr);
|
||||
*cursor->index, left_page_no, RW_X_LATCH, mtr);
|
||||
latch_leaves.blocks[0] = get_block;
|
||||
|
||||
if (spatial) {
|
||||
|
|
@ -299,7 +294,8 @@ btr_cur_latch_leaves(
|
|||
|
||||
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(
|
||||
page_id, zip_size, RW_X_LATCH, *cursor->index, mtr);
|
||||
*cursor->index, block->page.id.page_no(),
|
||||
RW_X_LATCH, mtr);
|
||||
latch_leaves.blocks[1] = get_block;
|
||||
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
|
|
@ -328,9 +324,9 @@ btr_cur_latch_leaves(
|
|||
mtr);
|
||||
}
|
||||
latch_leaves.savepoints[2] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(
|
||||
page_id_t(page_id.space(), right_page_no),
|
||||
zip_size, RW_X_LATCH, *cursor->index, mtr);
|
||||
get_block = btr_block_get(*cursor->index,
|
||||
right_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
latch_leaves.blocks[2] = get_block;
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(page_is_comp(get_block->frame)
|
||||
|
|
@ -357,8 +353,7 @@ btr_cur_latch_leaves(
|
|||
if (left_page_no != FIL_NULL) {
|
||||
latch_leaves.savepoints[0] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(
|
||||
page_id_t(page_id.space(), left_page_no),
|
||||
zip_size, mode, *cursor->index, mtr);
|
||||
*cursor->index, left_page_no, mode, mtr);
|
||||
latch_leaves.blocks[0] = get_block;
|
||||
cursor->left_block = get_block;
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
|
|
@ -370,8 +365,8 @@ btr_cur_latch_leaves(
|
|||
}
|
||||
|
||||
latch_leaves.savepoints[1] = mtr_set_savepoint(mtr);
|
||||
get_block = btr_block_get(page_id, zip_size, mode,
|
||||
*cursor->index, mtr);
|
||||
get_block = btr_block_get(*cursor->index,
|
||||
block->page.id.page_no(), mode, mtr);
|
||||
latch_leaves.blocks[1] = get_block;
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
|
||||
|
|
@ -729,7 +724,7 @@ btr_cur_optimistic_latch_leaves(
|
|||
unsigned line,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
ulint mode;
|
||||
rw_lock_type_t mode;
|
||||
ulint left_page_no;
|
||||
|
||||
switch (*latch_mode) {
|
||||
|
|
@ -761,15 +756,10 @@ btr_cur_optimistic_latch_leaves(
|
|||
buf_block_get_frame(block), mtr);
|
||||
rw_lock_s_unlock(&block->lock);
|
||||
|
||||
if (left_page_no != FIL_NULL) {
|
||||
cursor->left_block = btr_block_get(
|
||||
page_id_t(cursor->index->table->space_id,
|
||||
left_page_no),
|
||||
cursor->index->table->space->zip_size(),
|
||||
mode, *cursor->index, mtr);
|
||||
} else {
|
||||
cursor->left_block = NULL;
|
||||
}
|
||||
cursor->left_block = left_page_no != FIL_NULL
|
||||
? btr_block_get(*cursor->index, left_page_no, mode,
|
||||
mtr)
|
||||
: NULL;
|
||||
|
||||
if (buf_page_optimistic_get(mode, block, modify_clock,
|
||||
file, line, mtr)) {
|
||||
|
|
@ -1787,10 +1777,8 @@ retry_page_get:
|
|||
|
||||
if (height == 0) {
|
||||
if (rw_latch == RW_NO_LATCH) {
|
||||
|
||||
latch_leaves = btr_cur_latch_leaves(
|
||||
block, page_id, zip_size, latch_mode,
|
||||
cursor, mtr);
|
||||
block, latch_mode, cursor, mtr);
|
||||
}
|
||||
|
||||
switch (latch_mode) {
|
||||
|
|
@ -2346,20 +2334,12 @@ need_opposite_intention:
|
|||
ut_ad(!autoinc);
|
||||
|
||||
if (upper_rw_latch == RW_NO_LATCH) {
|
||||
/* latch the page */
|
||||
buf_block_t* child_block;
|
||||
|
||||
if (latch_mode == BTR_CONT_MODIFY_TREE) {
|
||||
child_block = btr_block_get(
|
||||
page_id, zip_size, RW_X_LATCH,
|
||||
*index, mtr);
|
||||
} else {
|
||||
ut_ad(latch_mode == BTR_CONT_SEARCH_TREE);
|
||||
child_block = btr_block_get(
|
||||
page_id, zip_size, RW_SX_LATCH,
|
||||
*index, mtr);
|
||||
}
|
||||
|
||||
ut_ad(latch_mode == BTR_CONT_MODIFY_TREE
|
||||
|| latch_mode == BTR_CONT_SEARCH_TREE);
|
||||
buf_block_t* child_block = btr_block_get(
|
||||
*index, page_id.page_no(),
|
||||
latch_mode == BTR_CONT_MODIFY_TREE
|
||||
? RW_X_LATCH : RW_SX_LATCH, mtr);
|
||||
btr_assert_not_corrupted(child_block, index);
|
||||
} else {
|
||||
ut_ad(mtr_memo_contains(mtr, block, upper_rw_latch));
|
||||
|
|
@ -2653,13 +2633,11 @@ btr_cur_open_at_index_side_func(
|
|||
if (height == level) {
|
||||
if (srv_read_only_mode) {
|
||||
btr_cur_latch_leaves(
|
||||
block, page_id, zip_size,
|
||||
latch_mode, cursor, mtr);
|
||||
block, latch_mode, cursor, mtr);
|
||||
} else if (height == 0) {
|
||||
if (rw_latch == RW_NO_LATCH) {
|
||||
btr_cur_latch_leaves(
|
||||
block, page_id, zip_size,
|
||||
latch_mode, cursor, mtr);
|
||||
btr_cur_latch_leaves(block, latch_mode,
|
||||
cursor, mtr);
|
||||
}
|
||||
/* In versions <= 3.23.52 we had
|
||||
forgotten to release the tree latch
|
||||
|
|
@ -3007,9 +2985,8 @@ btr_cur_open_at_rnd_pos_func(
|
|||
if (height == 0) {
|
||||
if (rw_latch == RW_NO_LATCH
|
||||
|| srv_read_only_mode) {
|
||||
btr_cur_latch_leaves(
|
||||
block, page_id, zip_size,
|
||||
latch_mode, cursor, mtr);
|
||||
btr_cur_latch_leaves(block, latch_mode, cursor,
|
||||
mtr);
|
||||
}
|
||||
|
||||
/* btr_cur_open_at_index_side_func() and
|
||||
|
|
@ -7474,9 +7451,7 @@ struct btr_blob_log_check_t {
|
|||
if (m_op == BTR_STORE_INSERT_BULK) {
|
||||
mtr_x_lock(dict_index_get_lock(index), m_mtr);
|
||||
m_pcur->btr_cur.page_cur.block = btr_block_get(
|
||||
page_id_t(index->table->space_id, page_no),
|
||||
index->table->space->zip_size(),
|
||||
RW_X_LATCH, *index, m_mtr);
|
||||
*index, page_no, RW_X_LATCH, m_mtr);
|
||||
m_pcur->btr_cur.page_cur.rec
|
||||
= m_pcur->btr_cur.page_cur.block->frame
|
||||
+ offs;
|
||||
|
|
|
|||
|
|
@ -162,11 +162,7 @@ btr_defragment_add_index(
|
|||
*err = DB_SUCCESS;
|
||||
|
||||
mtr_start(&mtr);
|
||||
// Load index rood page.
|
||||
buf_block_t* block = btr_block_get(
|
||||
page_id_t(index->table->space_id, index->page),
|
||||
index->table->space->zip_size(),
|
||||
RW_NO_LATCH, *index, &mtr);
|
||||
buf_block_t* block = btr_root_block_get(index, RW_NO_LATCH, &mtr);
|
||||
page_t* page = NULL;
|
||||
|
||||
if (block) {
|
||||
|
|
@ -369,7 +365,7 @@ btr_defragment_calc_n_recs_for_size(
|
|||
Merge as many records from the from_block to the to_block. Delete
|
||||
the from_block if all records are successfully merged to to_block.
|
||||
@return the to_block to target for next merge operation. */
|
||||
UNIV_INTERN
|
||||
static
|
||||
buf_block_t*
|
||||
btr_defragment_merge_pages(
|
||||
dict_index_t* index, /*!< in: index tree */
|
||||
|
|
@ -589,9 +585,7 @@ btr_defragment_n_pages(
|
|||
break;
|
||||
}
|
||||
|
||||
blocks[i] = btr_block_get(page_id_t(index->table->space_id,
|
||||
page_no), zip_size,
|
||||
RW_X_LATCH, *index, mtr);
|
||||
blocks[i] = btr_block_get(*index, page_no, RW_X_LATCH, mtr);
|
||||
}
|
||||
|
||||
if (n_pages == 1) {
|
||||
|
|
|
|||
|
|
@ -439,29 +439,23 @@ btr_pcur_move_to_next_page(
|
|||
last record of the current page */
|
||||
mtr_t* mtr) /*!< in: mtr */
|
||||
{
|
||||
ulint next_page_no;
|
||||
page_t* page;
|
||||
buf_block_t* next_block;
|
||||
page_t* next_page;
|
||||
ulint mode;
|
||||
|
||||
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
|
||||
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
|
||||
ut_ad(btr_pcur_is_after_last_on_page(cursor));
|
||||
|
||||
cursor->old_stored = false;
|
||||
|
||||
page = btr_pcur_get_page(cursor);
|
||||
const page_t* page = btr_pcur_get_page(cursor);
|
||||
|
||||
if (UNIV_UNLIKELY(!page)) {
|
||||
return;
|
||||
}
|
||||
|
||||
next_page_no = btr_page_get_next(page, mtr);
|
||||
const ulint next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
|
||||
|
||||
ut_ad(next_page_no != FIL_NULL);
|
||||
|
||||
mode = cursor->latch_mode;
|
||||
ulint mode = cursor->latch_mode;
|
||||
switch (mode) {
|
||||
case BTR_SEARCH_TREE:
|
||||
mode = BTR_SEARCH_LEAF;
|
||||
|
|
@ -470,18 +464,14 @@ btr_pcur_move_to_next_page(
|
|||
mode = BTR_MODIFY_LEAF;
|
||||
}
|
||||
|
||||
buf_block_t* block = btr_pcur_get_block(cursor);
|
||||
|
||||
next_block = btr_block_get(
|
||||
page_id_t(block->page.id.space(), next_page_no),
|
||||
block->zip_size(), mode,
|
||||
*btr_pcur_get_btr_cur(cursor)->index, mtr);
|
||||
buf_block_t* next_block = btr_block_get(
|
||||
*btr_pcur_get_btr_cur(cursor)->index, next_page_no, mode, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(!next_block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
next_page = buf_block_get_frame(next_block);
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -434,7 +434,6 @@ btr_pessimistic_scrub(
|
|||
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 ulint zip_size = index->table->space->zip_size();
|
||||
|
||||
/**
|
||||
* When splitting page, we need X-latches on left/right brothers
|
||||
|
|
@ -449,16 +448,12 @@ btr_pessimistic_scrub(
|
|||
*/
|
||||
mtr->release_block_at_savepoint(scrub_data->savepoint, block);
|
||||
|
||||
btr_block_get(
|
||||
page_id_t(index->table->space_id, left_page_no),
|
||||
zip_size, RW_X_LATCH, *index, mtr);
|
||||
btr_block_get(*index, left_page_no, RW_X_LATCH, mtr);
|
||||
|
||||
/**
|
||||
* Refetch block and re-initialize page
|
||||
*/
|
||||
block = btr_block_get(
|
||||
page_id_t(index->table->space_id, page_no),
|
||||
zip_size, RW_X_LATCH, *index, mtr);
|
||||
block = btr_block_get(*index, page_no, RW_X_LATCH, mtr);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
|
|
@ -470,9 +465,7 @@ btr_pessimistic_scrub(
|
|||
}
|
||||
|
||||
if (right_page_no != FIL_NULL) {
|
||||
btr_block_get(
|
||||
page_id_t(index->table->space_id, right_page_no),
|
||||
zip_size, RW_X_LATCH, *index, mtr);
|
||||
btr_block_get(*index, right_page_no, RW_X_LATCH, mtr);
|
||||
}
|
||||
|
||||
/* arguments to btr_page_split_and_insert */
|
||||
|
|
|
|||
|
|
@ -648,7 +648,6 @@ rtr_adjust_upper_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;
|
||||
|
|
@ -752,16 +751,12 @@ rtr_adjust_upper_level(
|
|||
/* 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);
|
||||
*index, prev_page_no, RW_X_LATCH, 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)
|
||||
|
|
@ -774,11 +769,8 @@ rtr_adjust_upper_level(
|
|||
}
|
||||
|
||||
if (next_page_no != FIL_NULL) {
|
||||
page_id_t next_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);
|
||||
*index, next_page_no, RW_X_LATCH, 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)
|
||||
|
|
@ -1879,16 +1871,17 @@ rtr_estimate_n_rows_in_range(
|
|||
index->set_modified(mtr);
|
||||
mtr_s_lock(&index->lock, &mtr);
|
||||
|
||||
buf_block_t* block = btr_block_get(
|
||||
page_id_t(index->table->space_id, index->page),
|
||||
index->table->space->zip_size(),
|
||||
RW_S_LATCH, *index, &mtr);
|
||||
buf_block_t* block = btr_root_block_get(index, RW_S_LATCH, &mtr);
|
||||
if (!block) {
|
||||
err_exit:
|
||||
mtr.commit();
|
||||
return HA_POS_ERROR;
|
||||
}
|
||||
const page_t* page = buf_block_get_frame(block);
|
||||
const unsigned n_recs = page_header_get_field(page, PAGE_N_RECS);
|
||||
|
||||
if (n_recs == 0) {
|
||||
mtr.commit();
|
||||
return(HA_POS_ERROR);
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
/* Scan records in root page and calculate area. */
|
||||
|
|
|
|||
|
|
@ -422,9 +422,7 @@ rtr_pcur_getnext_from_path(
|
|||
|
||||
btr_cur_latch_leaves(
|
||||
block,
|
||||
page_id_t(index->table->space_id,
|
||||
block->page.id.page_no()),
|
||||
zip_size, BTR_MODIFY_TREE,
|
||||
BTR_MODIFY_TREE,
|
||||
btr_cur, mtr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,36 +217,53 @@ btr_height_get(
|
|||
mtr_t* mtr) /*!< in/out: mini-transaction */
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/** Gets a buffer page and declares its latching order level.
|
||||
@param[in] page_id page id
|
||||
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
|
||||
/** Get an index page and declare its latching order level.
|
||||
@param[in] index index tree
|
||||
@param[in] page page number
|
||||
@param[in] mode latch mode
|
||||
@param[in] file file name
|
||||
@param[in] line line where called
|
||||
@param[in] index index tree
|
||||
@param[in,out] mtr mini-transaction
|
||||
@return block */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get_func(
|
||||
const page_id_t page_id,
|
||||
ulint zip_size,
|
||||
ulint mode,
|
||||
const char* file,
|
||||
unsigned line,
|
||||
const dict_index_t& index,
|
||||
mtr_t* mtr);
|
||||
inline buf_block_t* btr_block_get_func(const dict_index_t& index, ulint page,
|
||||
ulint mode,
|
||||
const char* file, unsigned line,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
dberr_t err;
|
||||
|
||||
if (buf_block_t* block = buf_page_get_gen(
|
||||
page_id_t(index.table->space->id, page),
|
||||
index.table->space->zip_size(), mode, NULL, BUF_GET,
|
||||
file, line, mtr, &err)) {
|
||||
ut_ad(err == DB_SUCCESS);
|
||||
if (mode != RW_NO_LATCH) {
|
||||
buf_block_dbg_add_level(block, index.is_ibuf()
|
||||
? SYNC_IBUF_TREE_NODE
|
||||
: SYNC_TREE_NODE);
|
||||
}
|
||||
return block;
|
||||
} else {
|
||||
ut_ad(err != DB_SUCCESS);
|
||||
|
||||
if (err == DB_DECRYPTION_FAILED) {
|
||||
if (index.table) {
|
||||
index.table->file_unreadable = true;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets a buffer page and declares its latching order level.
|
||||
@param page_id tablespace/page identifier
|
||||
@param zip_size ROW_FORMAT=COMPRESSED page size, or 0
|
||||
@param mode latch mode
|
||||
@param index index tree
|
||||
@param page page number
|
||||
@param mode latch mode
|
||||
@param mtr mini-transaction handle
|
||||
@return the block descriptor */
|
||||
# define btr_block_get(page_id, zip_size, mode, index, mtr) \
|
||||
btr_block_get_func(page_id, zip_size, mode, \
|
||||
__FILE__, __LINE__, index, mtr)
|
||||
# define btr_block_get(index, page, mode, mtr) \
|
||||
btr_block_get_func(index, page, mode, __FILE__, __LINE__, mtr)
|
||||
/**************************************************************//**
|
||||
Gets the index id field of a page.
|
||||
@return index id */
|
||||
|
|
@ -689,7 +706,7 @@ buf_block_t*
|
|||
btr_root_block_get(
|
||||
/*===============*/
|
||||
const dict_index_t* index, /*!< in: index tree */
|
||||
ulint mode, /*!< in: either RW_S_LATCH
|
||||
rw_lock_type_t mode, /*!< in: either RW_S_LATCH
|
||||
or RW_X_LATCH */
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
|
||||
|
|
|
|||
|
|
@ -29,48 +29,6 @@ Created 6/2/1994 Heikki Tuuri
|
|||
#include "mtr0log.h"
|
||||
#include "page0zip.h"
|
||||
|
||||
/** Gets a buffer page and declares its latching order level.
|
||||
@param[in] page_id page id
|
||||
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
|
||||
@param[in] mode latch mode
|
||||
@param[in] file file name
|
||||
@param[in] line line where called
|
||||
@param[in] index index tree, may be NULL if it is not an insert buffer
|
||||
tree
|
||||
@param[in,out] mtr mini-transaction
|
||||
@return block */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get_func(
|
||||
const page_id_t page_id,
|
||||
ulint zip_size,
|
||||
ulint mode,
|
||||
const char* file,
|
||||
unsigned line,
|
||||
const dict_index_t& index,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
buf_block_t* block;
|
||||
dberr_t err=DB_SUCCESS;
|
||||
|
||||
block = buf_page_get_gen(
|
||||
page_id, zip_size, mode, NULL, BUF_GET, file, line, mtr, &err);
|
||||
|
||||
if (err == DB_DECRYPTION_FAILED) {
|
||||
if (index.table) {
|
||||
index.table->file_unreadable = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (block && mode != RW_NO_LATCH) {
|
||||
buf_block_dbg_add_level(block, index.is_ibuf()
|
||||
? SYNC_IBUF_TREE_NODE
|
||||
: SYNC_TREE_NODE);
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
/**************************************************************//**
|
||||
Sets the index id field of a page. */
|
||||
UNIV_INLINE
|
||||
|
|
|
|||
|
|
@ -821,8 +821,6 @@ btr_rec_set_deleted_flag(
|
|||
|
||||
/** Latches the leaf page or pages requested.
|
||||
@param[in] block leaf page where the search converged
|
||||
@param[in] page_id page id of the leaf
|
||||
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
|
||||
@param[in] latch_mode BTR_SEARCH_LEAF, ...
|
||||
@param[in] cursor cursor
|
||||
@param[in] mtr mini-transaction
|
||||
|
|
@ -830,8 +828,6 @@ btr_rec_set_deleted_flag(
|
|||
btr_latch_leaves_t
|
||||
btr_cur_latch_leaves(
|
||||
buf_block_t* block,
|
||||
const page_id_t page_id,
|
||||
ulint zip_size,
|
||||
ulint latch_mode,
|
||||
btr_cur_t* cursor,
|
||||
mtr_t* mtr);
|
||||
|
|
|
|||
|
|
@ -526,7 +526,8 @@ struct btr_pcur_t{
|
|||
ulint buf_size;
|
||||
|
||||
btr_pcur_t() :
|
||||
btr_cur(), latch_mode(0), old_stored(false), old_rec(NULL),
|
||||
btr_cur(), latch_mode(RW_NO_LATCH),
|
||||
old_stored(false), old_rec(NULL),
|
||||
old_n_fields(0), rel_pos(btr_pcur_pos_t(0)),
|
||||
block_when_stored(NULL),
|
||||
modify_clock(0), withdraw_clock(0),
|
||||
|
|
|
|||
|
|
@ -2028,11 +2028,8 @@ end_of_index:
|
|||
|
||||
block = page_cur_get_block(cur);
|
||||
block = btr_block_get(
|
||||
page_id_t(block->page.id.space(),
|
||||
next_page_no),
|
||||
block->zip_size(),
|
||||
BTR_SEARCH_LEAF,
|
||||
*clust_index, &mtr);
|
||||
*clust_index, next_page_no,
|
||||
RW_S_LATCH, &mtr);
|
||||
|
||||
btr_leaf_page_release(page_cur_get_block(cur),
|
||||
BTR_SEARCH_LEAF, &mtr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue