Skip to content

Commit

Permalink
MDEV-24142: Remove __FILE__,__LINE__ related to buf_block_t::lock
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 3, 2020
1 parent ac028ec commit 9702be2
Show file tree
Hide file tree
Showing 28 changed files with 104 additions and 313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at s
call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)");
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't1' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: btr_pcur_open_low level: 0 called from file: ");
call mtr.add_suppression("InnoDB: btr_pcur_open_low level: 0 table: `test`\\.`t1` index: `PRIMARY`");
--enable_query_log
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0;

Expand Down
23 changes: 6 additions & 17 deletions storage/innobase/btr/btr0btr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ btr_root_adjust_on_import(
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);
Expand Down Expand Up @@ -784,8 +783,6 @@ btr_page_get_father_node_ptr_func(
its page x-latched */
ulint latch_mode,/*!< in: BTR_CONT_MODIFY_TREE
or BTR_CONT_SEARCH_TREE */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dtuple_t* tuple;
Expand Down Expand Up @@ -818,15 +815,12 @@ btr_page_get_father_node_ptr_func(

err = btr_cur_search_to_nth_level(
index, level + 1, tuple,
PAGE_CUR_LE, latch_mode, cursor, 0,
file, line, mtr);
PAGE_CUR_LE, latch_mode, cursor, 0, mtr);

if (err != DB_SUCCESS) {
ib::warn() << " Error code: " << err
<< " btr_page_get_father_node_ptr_func "
<< " level: " << level + 1
<< " called from file: "
<< file << " line: " << line
<< " table: " << index->table->name
<< " index: " << index->name();
}
Expand Down Expand Up @@ -869,11 +863,11 @@ btr_page_get_father_node_ptr_func(

#define btr_page_get_father_node_ptr(of,heap,cur,mtr) \
btr_page_get_father_node_ptr_func( \
of,heap,cur,BTR_CONT_MODIFY_TREE,__FILE__,__LINE__,mtr)
of,heap,cur,BTR_CONT_MODIFY_TREE,mtr)

#define btr_page_get_father_node_ptr_for_validate(of,heap,cur,mtr) \
btr_page_get_father_node_ptr_func( \
of,heap,cur,BTR_CONT_SEARCH_TREE,__FILE__,__LINE__,mtr)
of,heap,cur,BTR_CONT_SEARCH_TREE,mtr)

/************************************************************//**
Returns the upper level node pointer to a page. It is assumed that mtr holds
Expand Down Expand Up @@ -2320,14 +2314,11 @@ btr_page_insert_fits(
Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */
void
btr_insert_on_non_leaf_level_func(
/*==============================*/
btr_insert_on_non_leaf_level(
ulint flags, /*!< in: undo logging and locking flags */
dict_index_t* index, /*!< in: index */
ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
big_rec_t* dummy_big_rec;
Expand All @@ -2346,14 +2337,12 @@ btr_insert_on_non_leaf_level_func(
dberr_t err = btr_cur_search_to_nth_level(
index, level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE,
&cursor, 0, file, line, mtr);
&cursor, 0, mtr);

if (err != DB_SUCCESS) {
ib::warn() << " Error code: " << err
<< " btr_page_get_father_node_ptr_func "
<< " level: " << level
<< " called from file: "
<< file << " line: " << line
<< " table: " << index->table->name
<< " index: " << index->name;
}
Expand All @@ -2367,7 +2356,7 @@ btr_insert_on_non_leaf_level_func(
btr_cur_search_to_nth_level(index, level, tuple,
PAGE_CUR_RTREE_INSERT,
BTR_CONT_MODIFY_TREE,
&cursor, 0, file, line, mtr);
&cursor, 0, mtr);
}

ut_ad(cursor.flag == BTR_CUR_BINARY);
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/btr/btr0bulk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,12 @@ PageBulk::latch()

/* In case the block is S-latched by page_cleaner. */
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
__FILE__, __LINE__, &m_mtr)) {
&m_mtr)) {
m_block = buf_page_get_gen(page_id_t(m_index->table->space_id,
m_page_no),
0, RW_X_LATCH,
m_block, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &m_mtr, &m_err);
&m_mtr, &m_err);

if (m_err != DB_SUCCESS) {
return (m_err);
Expand Down
42 changes: 13 additions & 29 deletions storage/innobase/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,6 @@ bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
@param[in] modify_clock modify clock value
@param[in,out] latch_mode BTR_SEARCH_LEAF, ...
@param[in,out] cursor cursor
@param[in] file file name
@param[in] line line where called
@param[in] mtr mini-transaction
@return true if success */
bool
Expand All @@ -765,8 +763,6 @@ btr_cur_optimistic_latch_leaves(
ib_uint64_t modify_clock,
ulint* latch_mode,
btr_cur_t* cursor,
const char* file,
unsigned line,
mtr_t* mtr)
{
ut_ad(block->page.buf_fix_count());
Expand All @@ -779,7 +775,7 @@ btr_cur_optimistic_latch_leaves(
case BTR_SEARCH_LEAF:
case BTR_MODIFY_LEAF:
return(buf_page_optimistic_get(*latch_mode, block,
modify_clock, file, line, mtr));
modify_clock, mtr));
case BTR_SEARCH_PREV:
case BTR_MODIFY_PREV:
block->lock.s_lock();
Expand All @@ -801,7 +797,7 @@ btr_cur_optimistic_latch_leaves(
left_page_no),
cursor->index->table->space->zip_size(),
mode, nullptr, BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, mtr, &err);
mtr, &err);

if (err == DB_DECRYPTION_FAILED) {
cursor->index->table->file_unreadable = true;
Expand All @@ -818,8 +814,7 @@ btr_cur_optimistic_latch_leaves(
cursor->left_block = NULL;
}

if (buf_page_optimistic_get(mode, block, modify_clock,
file, line, mtr)) {
if (buf_page_optimistic_get(mode, block, modify_clock, mtr)) {
if (btr_page_get_prev(block->frame) == left_page_no) {
/* block was already buffer-fixed while
entering the function and
Expand Down Expand Up @@ -1247,8 +1242,6 @@ btr_cur_search_to_nth_level_func(
srw_lock* ahi_latch,
/*!< in: currently held AHI rdlock, or NULL */
#endif /* BTR_CUR_HASH_ADAPT */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr, /*!< in: mtr */
ib_uint64_t autoinc)/*!< in: PAGE_ROOT_AUTO_INC to be written
(0 if none) */
Expand Down Expand Up @@ -1609,7 +1602,7 @@ btr_cur_search_to_nth_level_func(
ut_ad(n_blocks < BTR_MAX_LEVELS);
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
block = buf_page_get_gen(page_id, zip_size, rw_latch, guess,
buf_mode, file, line, mtr, &err,
buf_mode, mtr, &err,
height == 0 && !index->is_clust());
tree_blocks[n_blocks] = block;

Expand Down Expand Up @@ -1725,7 +1718,7 @@ btr_cur_search_to_nth_level_func(
get_block = buf_page_get_gen(
page_id_t(page_id.space(), left_page_no),
zip_size, rw_latch, NULL, buf_mode,
file, line, mtr, &err);
mtr, &err);
prev_tree_blocks[prev_n_blocks] = get_block;
prev_n_blocks++;

Expand Down Expand Up @@ -1755,8 +1748,7 @@ btr_cur_search_to_nth_level_func(

tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
block = buf_page_get_gen(page_id, zip_size,
rw_latch, NULL, buf_mode,
file, line, mtr, &err);
rw_latch, NULL, buf_mode, mtr, &err);
tree_blocks[n_blocks] = block;

if (err != DB_SUCCESS) {
Expand Down Expand Up @@ -2510,17 +2502,14 @@ btr_cur_search_to_nth_level_func(
/*****************************************************************//**
Opens a cursor at either end of an index. */
dberr_t
btr_cur_open_at_index_side_func(
/*============================*/
btr_cur_open_at_index_side(
bool from_left, /*!< in: true if open to the low end,
false if to the high end */
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: latch mode */
btr_cur_t* cursor, /*!< in/out: cursor */
ulint level, /*!< in: level to search for
(0=leaf). */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
page_cur_t* page_cursor;
Expand Down Expand Up @@ -2630,7 +2619,7 @@ btr_cur_open_at_index_side_func(
? upper_rw_latch : RW_NO_LATCH;
buf_block_t* block = buf_page_get_gen(page_id, zip_size,
rw_latch, NULL, BUF_GET,
file, line, mtr, &err,
mtr, &err,
height == 0
&& !index->is_clust());
ut_ad((block != NULL) == (err == DB_SUCCESS));
Expand Down Expand Up @@ -2866,13 +2855,10 @@ Positions a cursor at a randomly chosen position within a B-tree.
@return true if the index is available and we have put the cursor, false
if the index is unavailable */
bool
btr_cur_open_at_rnd_pos_func(
/*=========================*/
btr_cur_open_at_rnd_pos(
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
Expand Down Expand Up @@ -2971,7 +2957,7 @@ btr_cur_open_at_rnd_pos_func(
? upper_rw_latch : RW_NO_LATCH;
buf_block_t* block = buf_page_get_gen(page_id, zip_size,
rw_latch, NULL, BUF_GET,
file, line, mtr, &err,
mtr, &err,
height == 0
&& !index->is_clust());
tree_blocks[n_blocks] = block;
Expand Down Expand Up @@ -6031,7 +6017,7 @@ btr_estimate_n_rows_in_range_on_level(
silence a debug assertion about this. */
block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH,
NULL, BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr, &err);
&mtr, &err);

ut_ad((block != NULL) == (err == DB_SUCCESS));

Expand Down Expand Up @@ -6187,8 +6173,7 @@ btr_estimate_n_rows_in_range_low(
btr_cur_search_to_nth_level(index, 0, tuple1->tuple,
tuple1->mode,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0,
__FILE__, __LINE__, &mtr);
&cursor, 0, &mtr);

ut_ad(!page_rec_is_infimum(btr_cur_get_rec(&cursor)));

Expand Down Expand Up @@ -6244,8 +6229,7 @@ btr_estimate_n_rows_in_range_low(
btr_cur_search_to_nth_level(index, 0, tuple2->tuple,
mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0,
__FILE__, __LINE__, &mtr);
&cursor, 0, &mtr);

const rec_t* rec = btr_cur_get_rec(&cursor);

Expand Down
21 changes: 6 additions & 15 deletions storage/innobase/btr/btr0pcur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ struct optimistic_latch_leaves
{
return hint && btr_cur_optimistic_latch_leaves(
hint, cursor->modify_clock, latch_mode,
btr_pcur_get_btr_cur(cursor), __FILE__, __LINE__, mtr);
btr_pcur_get_btr_cur(cursor), mtr);
}
};

Expand All @@ -271,12 +271,9 @@ restores to before first or after the last in the tree.
record and it can be restored on a user record whose ordering fields
are identical to the ones of the original user record */
ibool
btr_pcur_restore_position_func(
/*===========================*/
btr_pcur_restore_position(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dict_index_t* index;
Expand Down Expand Up @@ -307,9 +304,7 @@ btr_pcur_restore_position_func(

if (err != DB_SUCCESS) {
ib::warn() << " Error code: " << err
<< " btr_pcur_restore_position_func "
<< " called from file: "
<< file << " line: " << line
<< " btr_pcur_restore_position "
<< " table: " << index->table->name
<< " index: " << index->name;
}
Expand Down Expand Up @@ -406,7 +401,7 @@ btr_pcur_restore_position_func(
#ifdef BTR_CUR_HASH_ADAPT
NULL,
#endif /* BTR_CUR_HASH_ADAPT */
file, line, mtr);
mtr);

/* Restore the old search mode */
cursor->search_mode = old_mode;
Expand Down Expand Up @@ -627,21 +622,17 @@ in the first case sets the cursor after last in tree, and in the latter case
before first in tree. The latching mode must be BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF. */
void
btr_pcur_open_on_user_rec_func(
/*===========================*/
btr_pcur_open_on_user_rec(
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
page_cur_mode_t mode, /*!< in: PAGE_CUR_L, ... */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor,
file, line, 0, mtr);
btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor, 0, mtr);

if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {

Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/btr/btr0sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,7 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id)
(recursively) x-latch it, even though we are only reading. */

block = buf_page_get_gen(page_id, 0, RW_X_LATCH, NULL,
BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
BUF_PEEK_IF_IN_POOL, &mtr);

if (block) {
/* If AHI is still valid, page can't be in free state.
Expand Down
Loading

0 comments on commit 9702be2

Please sign in to comment.