summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-10-14 12:06:50 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-14 12:06:50 +0300
commitd662d10e7ac420bd7eb3e9971480531e6677a5ef (patch)
tree48bf4841788ec3c3d766729a93d87e4f56175d7a
parentdf383043427fb22b0735fe31968db860f4cdb7a0 (diff)
downloadmariadb-git-bb-10.5-MDEV-26826.tar.gz
MDEV-26826 The guess in buf_page_get_gen() may not be helpfulbb-10.5-MDEV-26826
buf_page_get_low(), buf_page_get_gen(): Remove the parameter "guess". We will have to access the buf_pool.page_hash anyway, in order to acquire the page_hash_latch. So, knowing the block upfront might only help us in case the block is behind a deep hash bucket. We will also remove the build option WITH_INNODB_ROOT_GUESS, any references to the preprocessor symbol BTR_CUR_ADAPT, as well as the data fields trx_undo_t::guess_block and btr_search_t::root_guess.
-rw-r--r--storage/innobase/btr/btr0btr.cc2
-rw-r--r--storage/innobase/btr/btr0bulk.cc6
-rw-r--r--storage/innobase/btr/btr0cur.cc36
-rw-r--r--storage/innobase/btr/btr0sea.cc5
-rw-r--r--storage/innobase/buf/buf0buf.cc35
-rw-r--r--storage/innobase/dict/dict0dict.cc10
-rw-r--r--storage/innobase/dict/dict0stats.cc2
-rw-r--r--storage/innobase/fil/fil0crypt.cc18
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc1
-rw-r--r--storage/innobase/gis/gis0sea.cc9
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc11
-rw-r--r--storage/innobase/include/btr0btr.h2
-rw-r--r--storage/innobase/include/btr0sea.h32
-rw-r--r--storage/innobase/include/btr0sea.ic4
-rw-r--r--storage/innobase/include/buf0buf.h8
-rw-r--r--storage/innobase/include/dict0mem.h4
-rw-r--r--storage/innobase/include/trx0undo.h2
-rw-r--r--storage/innobase/innodb.cmake11
-rw-r--r--storage/innobase/lock/lock0lock.cc2
-rw-r--r--storage/innobase/log/log0recv.cc4
-rw-r--r--storage/innobase/row/row0import.cc4
-rw-r--r--storage/innobase/row/row0merge.cc4
-rw-r--r--storage/innobase/row/row0sel.cc4
-rw-r--r--storage/innobase/trx/trx0rec.cc2
-rw-r--r--storage/innobase/trx/trx0undo.cc7
25 files changed, 67 insertions, 158 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 4c832eb77e8..34d3f0c7e40 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -360,7 +360,7 @@ 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,
+ table->space->zip_size(), RW_X_LATCH, BUF_GET,
__FILE__, __LINE__,
&mtr, &err);
if (!block) {
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 9004064a1b9..83285e9bb7f 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -856,13 +856,13 @@ PageBulk::latch()
ut_ad(m_block->page.buf_fix_count());
- /* In case the block is S-latched by page_cleaner. */
+ /* In case the block is U-latched by page_cleaner. */
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
__FILE__, __LINE__, &m_mtr)) {
+ /* FIXME: avoid another lookup */
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,
+ 0, RW_X_LATCH, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &m_mtr, &m_err);
if (m_err != DB_SUCCESS) {
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index cfff322f547..7e5a6912c1e 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -807,7 +807,7 @@ btr_cur_optimistic_latch_leaves(
page_id_t(cursor->index->table->space_id,
left_page_no),
cursor->index->table->space->zip_size(),
- mode, nullptr, BUF_GET_POSSIBLY_FREED,
+ mode, BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, mtr, &err);
if (!cursor->left_block) {
@@ -1264,7 +1264,6 @@ btr_cur_search_to_nth_level_func(
{
page_t* page = NULL; /* remove warning */
buf_block_t* block;
- buf_block_t* guess;
ulint height;
ulint up_match;
ulint up_bytes;
@@ -1302,9 +1301,6 @@ btr_cur_search_to_nth_level_func(
DBUG_ENTER("btr_cur_search_to_nth_level");
-#ifdef BTR_CUR_ADAPT
- btr_search_t* info;
-#endif /* BTR_CUR_ADAPT */
mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
@@ -1402,13 +1398,8 @@ btr_cur_search_to_nth_level_func(
cursor->flag = BTR_CUR_BINARY;
cursor->index = index;
-#ifndef BTR_CUR_ADAPT
- guess = NULL;
-#else
- info = btr_search_get_info(index);
- guess = info->root_guess;
-
#ifdef BTR_CUR_HASH_ADAPT
+ btr_search_t* info = btr_search_get_info(index);
# ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
@@ -1446,14 +1437,12 @@ btr_cur_search_to_nth_level_func(
DBUG_RETURN(err);
}
-# endif /* BTR_CUR_HASH_ADAPT */
-#endif /* BTR_CUR_ADAPT */
+
btr_cur_n_non_sea++;
/* If the hash search did not succeed, do binary search down the
tree */
-#ifdef BTR_CUR_HASH_ADAPT
if (ahi_latch) {
/* Release possible search latch to obey latching order */
rw_lock_s_unlock(ahi_latch);
@@ -1613,7 +1602,7 @@ search_loop:
retry_page_get:
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,
+ block = buf_page_get_gen(page_id, zip_size, rw_latch,
buf_mode, file, line, mtr, &err,
height == 0 && !index->is_clust());
tree_blocks[n_blocks] = block;
@@ -1729,7 +1718,7 @@ retry_page_get:
= mtr_set_savepoint(mtr);
get_block = buf_page_get_gen(
page_id_t(page_id.space(), left_page_no),
- zip_size, rw_latch, NULL, buf_mode,
+ zip_size, rw_latch, buf_mode,
file, line, mtr, &err);
prev_tree_blocks[prev_n_blocks] = get_block;
prev_n_blocks++;
@@ -1760,7 +1749,7 @@ retry_page_get:
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
block = buf_page_get_gen(page_id, zip_size,
- rw_latch, NULL, buf_mode,
+ rw_latch, buf_mode,
file, line, mtr, &err);
tree_blocks[n_blocks] = block;
@@ -1838,10 +1827,6 @@ retry_page_get:
cursor->rtr_info->thr = cursor->thr;
rtr_get_mbr_from_tuple(tuple, &cursor->rtr_info->mbr);
}
-
-#ifdef BTR_CUR_ADAPT
- info->root_guess = block;
-#endif
}
if (height == 0) {
@@ -2038,7 +2023,6 @@ retry_page_get:
ut_ad(height > 0);
height--;
- guess = NULL;
node_ptr = page_cur_get_rec(page_cursor);
@@ -2381,8 +2365,6 @@ need_opposite_intention:
/* btr_insert_into_right_sibling() might cause
deleting node_ptr at upper level */
- guess = NULL;
-
if (height == 0) {
/* release the leaf pages if latched */
for (uint i = 0; i < 3; i++) {
@@ -2638,7 +2620,7 @@ btr_cur_open_at_index_side_func(
&& (latch_mode != BTR_MODIFY_TREE || height == level)
? upper_rw_latch : RW_NO_LATCH;
buf_block_t* block = buf_page_get_gen(page_id, zip_size,
- rw_latch, NULL, BUF_GET,
+ rw_latch, BUF_GET,
file, line, mtr, &err,
height == 0
&& !index->is_clust());
@@ -2979,7 +2961,7 @@ btr_cur_open_at_rnd_pos_func(
&& latch_mode != BTR_MODIFY_TREE
? upper_rw_latch : RW_NO_LATCH;
buf_block_t* block = buf_page_get_gen(page_id, zip_size,
- rw_latch, NULL, BUF_GET,
+ rw_latch, BUF_GET,
file, line, mtr, &err,
height == 0
&& !index->is_clust());
@@ -6076,7 +6058,7 @@ btr_estimate_n_rows_in_range_on_level(
the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to
silence a debug assertion about this. */
block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH,
- NULL, BUF_GET_POSSIBLY_FREED,
+ BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr, &err);
ut_ad((block != NULL) == (err == DB_SUCCESS));
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 2f75f567933..2e7332f8b56 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1436,7 +1436,6 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id)
{
buf_block_t* block;
mtr_t mtr;
- dberr_t err = DB_SUCCESS;
mtr_start(&mtr);
@@ -1446,9 +1445,9 @@ void btr_search_drop_page_hash_when_freed(const page_id_t page_id)
are possibly holding, we cannot s-latch the page, but must
(recursively) x-latch it, even though we are only reading. */
- block = buf_page_get_gen(page_id, 0, RW_X_LATCH, NULL,
+ block = buf_page_get_gen(page_id, 0, RW_X_LATCH,
BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
- &mtr, &err);
+ &mtr);
if (block) {
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 1c126191df3..c944d9b7044 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2844,7 +2844,6 @@ done:
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
@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
@param[in] file file name
@@ -2861,7 +2860,6 @@ buf_page_get_low(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
- buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
@@ -2924,31 +2922,11 @@ buf_page_get_low(
buf_pool.stat.n_page_gets++;
loop:
buf_block_t* fix_block;
- block = guess;
page_hash_latch* hash_lock = buf_pool.page_hash.lock<false>(fold);
- if (block) {
-
- /* If the guess is a compressed page descriptor that
- has been allocated by buf_page_alloc_descriptor(),
- it may have been freed by buf_relocate(). */
-
- if (!buf_pool.is_uncompressed(block)
- || page_id != block->page.id()
- || block->page.state() != BUF_BLOCK_FILE_PAGE) {
- /* Our guess was bogus or things have changed
- since. */
- guess = nullptr;
- goto lookup;
- } else {
- ut_ad(!block->page.in_zip_hash);
- }
- } else {
-lookup:
- block = reinterpret_cast<buf_block_t*>(
- buf_pool.page_hash_get_low(page_id, fold));
- }
+ block = reinterpret_cast<buf_block_t*>(
+ buf_pool.page_hash_get_low(page_id, fold));
if (!block || buf_pool.watch_is_sentinel(block->page)) {
hash_lock->read_unlock();
@@ -3284,15 +3262,12 @@ re_evict:
: buf_pool.page_hash_get_low(page_id, fold));
hash_lock->write_unlock();
- if (block != NULL) {
+ if (block) {
/* Either the page has been read in or
a watch was set on that in the window
where we released the buf_pool.mutex
and before we acquire the hash_lock
above. Try again. */
- guess = block;
-
- goto loop;
}
return(NULL);
@@ -3409,7 +3384,6 @@ get_latch:
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
@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
@param[in] file file name
@@ -3424,7 +3398,6 @@ buf_page_get_gen(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
- buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
@@ -3461,7 +3434,7 @@ buf_page_get_gen(
}
return buf_page_get_low(page_id, zip_size, rw_latch,
- guess, mode, file, line, mtr, err, allow_ibuf_merge);
+ mode, file, line, mtr, err, allow_ibuf_merge);
}
/********************************************************************//**
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 9c1750c588f..6c98e4d599a 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1291,7 +1291,7 @@ dict_index_t *dict_index_t::clone() const
ut_ad(!rtr_track);
const size_t size= sizeof *this + n_fields * sizeof(*fields) +
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
sizeof *search_info +
#endif
1 + strlen(name) +
@@ -1308,9 +1308,9 @@ dict_index_t *dict_index_t::clone() const
index->name= mem_heap_strdup(heap, name);
index->fields= static_cast<dict_field_t*>
(mem_heap_dup(heap, fields, n_fields * sizeof *fields));
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
index->search_info= btr_search_info_create(index->heap);
-#endif /* BTR_CUR_ADAPT */
+#endif /* BTR_CUR_HASH_ADAPT */
index->stat_n_diff_key_vals= static_cast<ib_uint64_t*>
(mem_heap_zalloc(heap, n_uniq * sizeof *stat_n_diff_key_vals));
index->stat_n_sample_sizes= static_cast<ib_uint64_t*>
@@ -2156,9 +2156,9 @@ dict_index_add_to_cache(
/* Add the new index as the last index for the table */
UT_LIST_ADD_LAST(new_index->table->indexes, new_index);
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
new_index->search_info = btr_search_info_create(new_index->heap);
-#endif /* BTR_CUR_ADAPT */
+#endif /* BTR_CUR_HASH_ADAPT */
new_index->page = unsigned(page_no);
rw_lock_create(index_tree_rw_lock_key, &new_index->lock,
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 42f75252cee..998d6e26917 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1519,7 +1519,7 @@ dict_stats_analyze_index_below_cur(
dberr_t err = DB_SUCCESS;
block = buf_page_get_gen(page_id, zip_size,
- RW_S_LATCH, NULL, BUF_GET,
+ RW_S_LATCH, BUF_GET,
__FILE__, __LINE__, &mtr, &err,
!index->is_clust()
&& 1 == btr_page_get_level(page));
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 240a2682efc..a26d62749cd 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1004,7 +1004,6 @@ fil_crypt_read_crypt_data(fil_space_t* space)
mtr.start();
if (buf_block_t* block = buf_page_get_gen(page_id_t(space->id, 0),
zip_size, RW_S_LATCH,
- nullptr,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr)) {
if (block->page.status == buf_page_t::FREED) {
@@ -1065,11 +1064,10 @@ static bool fil_crypt_start_encrypting_space(fil_space_t* space)
mtr.start();
/* 2 - get page 0 */
- dberr_t err = DB_SUCCESS;
if (buf_block_t* block = buf_page_get_gen(
page_id_t(space->id, 0), space->zip_size(),
- RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED,
- __FILE__, __LINE__, &mtr, &err)) {
+ RW_X_LATCH, BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr)) {
if (block->page.status == buf_page_t::FREED) {
goto abort;
}
@@ -1812,11 +1810,9 @@ fil_crypt_get_page_throttle_func(
return NULL;
}
- dberr_t err = DB_SUCCESS;
buf_block_t* block = buf_page_get_gen(page_id, zip_size, RW_X_LATCH,
- NULL,
BUF_PEEK_IF_IN_POOL, file, line,
- mtr, &err);
+ mtr);
if (block != NULL) {
/* page was in buffer pool */
state->crypt_stat.pages_read_from_cache++;
@@ -1835,10 +1831,8 @@ fil_crypt_get_page_throttle_func(
state->crypt_stat.pages_read_from_disk++;
const ulonglong start = my_interval_timer();
- block = buf_page_get_gen(page_id, zip_size,
- RW_X_LATCH,
- NULL, BUF_GET_POSSIBLY_FREED,
- file, line, mtr, &err);
+ block = buf_page_get_gen(page_id, zip_size, RW_X_LATCH,
+ BUF_GET_POSSIBLY_FREED, file, line, mtr);
const ulonglong end = my_interval_timer();
state->cnt_waited++;
@@ -2082,7 +2076,7 @@ fil_crypt_flush_space(
if (buf_block_t* block = buf_page_get_gen(
page_id_t(space->id, 0), space->zip_size(),
- RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED,
+ RW_X_LATCH, BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr)) {
if (block->page.status != buf_page_t::FREED) {
mtr.set_named_space(space);
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 962d18d8081..62af5f81c66 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -412,7 +412,6 @@ xdes_get_descriptor_const(
if (buf_block_t* block = buf_page_get_gen(page_id_t(space->id, page),
zip_size, RW_S_LATCH,
- nullptr,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, mtr)) {
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 1c22aab4d00..4ab41055874 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -265,12 +265,10 @@ rtr_pcur_getnext_from_path(
btr_cur->page_cur.block)));
#endif /* UNIV_RTR_DEBUG */
- dberr_t err = DB_SUCCESS;
-
block = buf_page_get_gen(
page_id_t(index->table->space_id,
next_rec.page_no), zip_size,
- rw_latch, NULL, BUF_GET, __FILE__, __LINE__, mtr, &err);
+ rw_latch, BUF_GET, __FILE__, __LINE__, mtr);
if (block == NULL) {
continue;
@@ -1353,12 +1351,9 @@ rtr_cur_restore_position(
ut_ad(r_cursor == node->cursor);
search_again:
- dberr_t err = DB_SUCCESS;
-
block = buf_page_get_gen(
page_id_t(index->table->space_id, page_no),
- zip_size, RW_X_LATCH, NULL,
- BUF_GET, __FILE__, __LINE__, mtr, &err);
+ zip_size, RW_X_LATCH, BUF_GET, __FILE__, __LINE__, mtr);
ut_ad(block);
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 9288a496735..9f5ff39b0eb 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -479,9 +479,9 @@ ibuf_init_at_db_start(void)
ibuf.index->n_uniq = REC_MAX_N_FIELDS;
rw_lock_create(index_tree_rw_lock_key, &ibuf.index->lock,
SYNC_IBUF_INDEX_TREE);
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
ibuf.index->search_info = btr_search_info_create(ibuf.index->heap);
-#endif /* BTR_CUR_ADAPT */
+#endif /* BTR_CUR_HASH_ADAPT */
ibuf.index->page = FSP_IBUF_TREE_ROOT_PAGE_NO;
ut_d(ibuf.index->cached = TRUE);
@@ -690,8 +690,7 @@ ibuf_bitmap_get_map_page_func(
{
buf_block_t* block = buf_page_get_gen(
ibuf_bitmap_page_no_calc(page_id, zip_size),
- zip_size, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED,
- file, line, mtr);
+ zip_size, RW_X_LATCH, BUF_GET_POSSIBLY_FREED, file, line, mtr);
if (block) {
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
@@ -997,7 +996,7 @@ ibuf_page_low(
buf_block_t* block = buf_page_get_gen(
ibuf_bitmap_page_no_calc(page_id, zip_size),
- zip_size, RW_NO_LATCH, NULL, BUF_GET_NO_LATCH,
+ zip_size, RW_NO_LATCH, BUF_GET_NO_LATCH,
file, line, &local_mtr, &err);
ret = ibuf_bitmap_page_get_bits_low(
@@ -2325,7 +2324,7 @@ tablespace_deleted:
mtr.start();
dberr_t err;
buf_page_get_gen(page_id_t(space_id, page_nos[i]),
- zip_size, RW_X_LATCH, nullptr,
+ zip_size, RW_X_LATCH,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr, &err, true);
mtr.commit();
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 8b2859bd770..d68ad8225a9 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -236,7 +236,7 @@ inline buf_block_t* btr_block_get_func(const dict_index_t& index,
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,
+ index.table->space->zip_size(), mode, BUF_GET,
file, line, mtr, &err, merge && !index.is_clust())) {
ut_ad(err == DB_SUCCESS);
if (mode != RW_NO_LATCH) {
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 1e6b667c324..dbf28eb8a59 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -159,19 +159,6 @@ static inline bool btr_search_own_any();
/** Unlock all search latches from shared mode. */
static inline void btr_search_s_unlock_all();
-#else /* BTR_CUR_HASH_ADAPT */
-# define btr_search_sys_create()
-# define btr_search_sys_free()
-# define btr_search_drop_page_hash_index(block)
-# define btr_search_s_lock_all(index)
-# define btr_search_s_unlock_all(index)
-# define btr_search_info_update(index, cursor)
-# define btr_search_move_or_delete_hash_entries(new_block, block)
-# define btr_search_update_hash_on_insert(cursor, ahi_latch)
-# define btr_search_update_hash_on_delete(cursor)
-#endif /* BTR_CUR_HASH_ADAPT */
-
-#ifdef BTR_CUR_ADAPT
/** Create and initialize search info.
@param[in,out] heap heap where created
@return own: search info struct */
@@ -183,16 +170,12 @@ static inline btr_search_t* btr_search_get_info(dict_index_t* index)
{
return(index->search_info);
}
-#endif /* BTR_CUR_ADAPT */
/** The search info struct in an index */
struct btr_search_t{
/* @{ The following fields are not protected by any latch.
Unfortunately, this means that they must be aligned to
the machine word, i.e., they cannot be turned into bit-fields. */
- buf_block_t* root_guess;/*!< the root page frame when it was last time
- fetched, or NULL */
-#ifdef BTR_CUR_HASH_ADAPT
ulint hash_analysis; /*!< when this exceeds
BTR_SEARCH_HASH_ANALYSIS, the hash
analysis starts; this is reset if no
@@ -234,7 +217,6 @@ struct btr_search_t{
far */
ulint n_searches; /*!< number of searches */
#endif /* UNIV_SEARCH_PERF_STAT */
-#endif /* BTR_CUR_HASH_ADAPT */
#ifdef UNIV_DEBUG
ulint magic_n; /*!< magic number @see BTR_SEARCH_MAGIC_N */
/** value of btr_search_t::magic_n, used in assertions */
@@ -242,7 +224,6 @@ struct btr_search_t{
#endif /* UNIV_DEBUG */
};
-#ifdef BTR_CUR_HASH_ADAPT
/** The hash index system */
struct btr_search_sys_t
{
@@ -385,8 +366,17 @@ the hash index */
over calls from MySQL. If we notice someone waiting for the latch, we
again set this much timeout. This is to reduce contention. */
#define BTR_SEA_TIMEOUT 10000
+# include "btr0sea.ic"
+#else /* BTR_CUR_HASH_ADAPT */
+# define btr_search_sys_create()
+# define btr_search_sys_free()
+# define btr_search_drop_page_hash_index(block)
+# define btr_search_s_lock_all(index)
+# define btr_search_s_unlock_all(index)
+# define btr_search_info_update(index, cursor)
+# define btr_search_move_or_delete_hash_entries(new_block, block)
+# define btr_search_update_hash_on_insert(cursor, ahi_latch)
+# define btr_search_update_hash_on_delete(cursor)
#endif /* BTR_CUR_HASH_ADAPT */
-#include "btr0sea.ic"
-
#endif
diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.ic
index 40eb5d86ead..76316458c1c 100644
--- a/storage/innobase/include/btr0sea.ic
+++ b/storage/innobase/include/btr0sea.ic
@@ -28,6 +28,7 @@ Created 2/17/1996 Heikki Tuuri
#include "btr0cur.h"
#include "buf0buf.h"
+#ifdef BTR_CUR_HASH_ADAPT
/** Create and initialize search info.
@param[in,out] heap heap where created
@return own: search info struct */
@@ -36,14 +37,11 @@ static inline btr_search_t* btr_search_info_create(mem_heap_t* heap)
btr_search_t* info = static_cast<btr_search_t*>(
mem_heap_zalloc(heap, sizeof(btr_search_t)));
ut_d(info->magic_n = BTR_SEARCH_MAGIC_N);
-#ifdef BTR_CUR_HASH_ADAPT
info->n_fields = 1;
info->left_side = TRUE;
-#endif /* BTR_CUR_HASH_ADAPT */
return(info);
}
-#ifdef BTR_CUR_HASH_ADAPT
/** Updates the search info.
@param[in,out] info search info
@param[in,out] cursor cursor which was just positioned */
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index e5e15730253..e4aa1c4a7f7 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -210,7 +210,7 @@ NOTE! The following macros should be used instead of buf_page_get_gen,
to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */
#define buf_page_get(ID, SIZE, LA, MTR) \
- buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, __FILE__, __LINE__, MTR)
+ buf_page_get_gen(ID, SIZE, LA, BUF_GET, __FILE__, __LINE__, MTR)
/**************************************************************//**
Use these macros to bufferfix a page with no latching. Remember not to
@@ -219,7 +219,7 @@ the contents of the page! We have separated this case, because it is
error-prone programming not to set a latch, and it should be used
with care. */
#define buf_page_get_with_no_latch(ID, SIZE, MTR) \
- buf_page_get_gen(ID, SIZE, RW_NO_LATCH, NULL, BUF_GET_NO_LATCH, \
+ buf_page_get_gen(ID, SIZE, RW_NO_LATCH, BUF_GET_NO_LATCH, \
__FILE__, __LINE__, MTR)
/********************************************************************//**
This is the general function used to get optimistic access to a database
@@ -275,7 +275,6 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size);
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
@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
@param[in] file file name
@@ -290,7 +289,6 @@ buf_page_get_gen(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
- buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
@@ -302,7 +300,6 @@ buf_page_get_gen(
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
-@param[in] guess guessed block or NULL
@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
@param[in] file file name
@@ -319,7 +316,6 @@ buf_page_get_low(
const page_id_t page_id,
ulint zip_size,
ulint rw_latch,
- buf_block_t* guess,
ulint mode,
const char* file,
unsigned line,
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index a039776dfbf..aaad328ef33 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1074,10 +1074,10 @@ struct dict_index_t {
dict_add_v_col_info* new_vcol_info;
UT_LIST_NODE_T(dict_index_t)
indexes;/*!< list of indexes of the table */
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
btr_search_t* search_info;
/*!< info used in optimistic searches */
-#endif /* BTR_CUR_ADAPT */
+#endif /* BTR_CUR_HASH_ADAPT */
row_log_t* online_log;
/*!< the log of modifications
during online index creation;
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index 319ea4ee8d9..f4ef8b69f29 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -317,8 +317,6 @@ struct trx_undo_t {
log if we think of it as a stack */
undo_no_t top_undo_no; /*!< undo number of the latest record
(IB_ID_MAX if the undo log is empty) */
- buf_block_t* guess_block; /*!< guess for the buffer block where
- the top page might reside */
/** @return whether the undo log is empty */
bool empty() const { return top_undo_no == IB_ID_MAX; }
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index cd8ba4f04d3..1a897b7fcd8 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -87,19 +87,10 @@ ADD_FEATURE_INFO(INNODB_COMPILER_HINTS INNODB_COMPILER_HINTS "InnoDB compiled wi
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG")
OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON)
-OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON)
IF(WITH_INNODB_AHI)
- ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT)
- IF(NOT WITH_INNODB_ROOT_GUESS)
- MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS")
- SET(WITH_INNODB_ROOT_GUESS ON)
- ENDIF()
-ELSEIF(WITH_INNODB_ROOT_GUESS)
- ADD_DEFINITIONS(-DBTR_CUR_ADAPT)
+ ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT)
ENDIF()
ADD_FEATURE_INFO(INNODB_AHI WITH_INNODB_AHI "InnoDB Adaptive Hash Index")
-ADD_FEATURE_INFO(INNODB_ROOT_GUESS WITH_INNODB_ROOT_GUESS
- "Cache index root block descriptors in InnoDB")
OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF)
IF(WITH_INNODB_EXTRA_DEBUG)
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index d7ec5736826..a7df9dafdcd 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -5000,7 +5000,7 @@ static void lock_rec_block_validate(const page_id_t page_id)
block = buf_page_get_gen(
page_id,
space->zip_size(),
- RW_X_LATCH, NULL,
+ RW_X_LATCH,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr, &err);
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index eb34fd8ede9..4f48006ff8b 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -688,7 +688,7 @@ public:
continue;
}
if (buf_block_t* block = buf_page_get_low(
- i.first, 0, RW_X_LATCH, nullptr,
+ i.first, 0, RW_X_LATCH,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr, nullptr, false)) {
if (UNIV_LIKELY_NULL(block->page.zip.data)) {
@@ -2700,7 +2700,7 @@ next_page:
mtr.start();
mtr.set_log_mode(MTR_LOG_NO_REDO);
if (buf_block_t *block= buf_page_get_low(page_id, 0, RW_X_LATCH,
- nullptr, BUF_GET_IF_IN_POOL,
+ BUF_GET_IF_IN_POOL,
__FILE__, __LINE__,
&mtr, nullptr, false))
{
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 7fe5cc1802c..e5436a0bb20 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -2159,8 +2159,8 @@ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW
in the buffer pool, evict it now, because
we no longer evict the pages on DISCARD TABLESPACE. */
buf_page_get_gen(block->page.id(), get_zip_size(),
- RW_NO_LATCH, NULL, BUF_EVICT_IF_IN_POOL,
- __FILE__, __LINE__, NULL, NULL);
+ RW_NO_LATCH, BUF_EVICT_IF_IN_POOL,
+ __FILE__, __LINE__, nullptr);
uint16_t page_type;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 417bf6a4a1f..aa5404550d5 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -46,9 +46,9 @@ Completed by Sunny Bains and Marko Makela
#include "row0vers.h"
#include "handler0alter.h"
#include "btr0bulk.h"
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_HASH_ADAPT
# include "btr0sea.h"
-#endif /* BTR_CUR_ADAPT */
+#endif /* BTR_CUR_HASH_ADAPT */
#include "ut0stage.h"
#include "fil0crypt.h"
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index cc82bec475d..5b12b592abd 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -1183,7 +1183,7 @@ re_scan:
cur_block = buf_page_get_gen(
page_id_t(index->table->space_id, page_no),
index->table->space->zip_size(),
- RW_X_LATCH, NULL, BUF_GET,
+ RW_X_LATCH, BUF_GET,
__FILE__, __LINE__, mtr, &err);
} else {
mtr->start();
@@ -3384,7 +3384,7 @@ Row_sel_get_clust_rec_for_mysql::operator()(
buf_block_t* block = buf_page_get_gen(
btr_pcur_get_block(prebuilt->pcur)->page.id(),
btr_pcur_get_block(prebuilt->pcur)->zip_size(),
- RW_NO_LATCH, NULL, BUF_GET,
+ RW_NO_LATCH, BUF_GET,
__FILE__, __LINE__, mtr, &err);
mem_heap_t* heap = mem_heap_create(256);
dtuple_t* tuple = dict_index_build_data_tuple(
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 438dfcf9352..6f8ddc5c538 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1914,7 +1914,6 @@ dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
undo->top_page_no = undo->last_page_no;
undo->top_offset = offset;
undo->top_undo_no = trx->undo_no++;
- undo->guess_block = block;
ut_ad(!undo->empty());
err = DB_SUCCESS;
@@ -2077,7 +2076,6 @@ trx_undo_report_row_operation(
mtr.commit();
undo->top_offset = offset;
undo->top_undo_no = trx->undo_no++;
- undo->guess_block = undo_block;
ut_ad(!undo->empty());
if (!is_temp) {
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index 3d2d9752a42..fd5b10f826e 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -1009,7 +1009,6 @@ trx_undo_mem_create(
undo->top_undo_no = IB_ID_MAX;
undo->top_page_no = page_no;
- undo->guess_block = NULL;
ut_ad(undo->empty());
return(undo);
@@ -1185,8 +1184,7 @@ trx_undo_assign(trx_t* trx, dberr_t* err, mtr_t* mtr)
if (undo) {
return buf_page_get_gen(
page_id_t(undo->rseg->space->id, undo->last_page_no),
- 0, RW_X_LATCH, undo->guess_block,
- BUF_GET, __FILE__, __LINE__, mtr, err);
+ 0, RW_X_LATCH, BUF_GET, __FILE__, __LINE__, mtr, err);
}
trx_rseg_t* rseg = trx->rsegs.m_redo.rseg;
@@ -1239,8 +1237,7 @@ trx_undo_assign_low(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** undo,
if (*undo) {
return buf_page_get_gen(
page_id_t(rseg->space->id, (*undo)->last_page_no),
- 0, RW_X_LATCH, (*undo)->guess_block,
- BUF_GET, __FILE__, __LINE__, mtr, err);
+ 0, RW_X_LATCH, BUF_GET, __FILE__, __LINE__, mtr, err);
}
DBUG_EXECUTE_IF(