summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/btr/btr0cur.cc19
-rw-r--r--storage/innobase/btr/btr0defragment.cc8
-rw-r--r--storage/innobase/btr/btr0scrub.cc17
3 files changed, 33 insertions, 11 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 5dbae5d291d..db23b75edf1 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -1671,15 +1671,24 @@ btr_cur_pessimistic_insert(
btr_cur_get_page_zip(cursor),
thr_get_trx(thr)->id, mtr);
}
- if (!page_rec_is_infimum(btr_cur_get_rec(cursor))
- || btr_page_get_prev(
- buf_block_get_frame(
- btr_cur_get_block(cursor)), mtr)
- == FIL_NULL) {
+
+ if (!page_rec_is_infimum(btr_cur_get_rec(cursor))) {
/* split and inserted need to call
lock_update_insert() always. */
inherit = TRUE;
}
+
+ buf_block_t* block = btr_cur_get_block(cursor);
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ /* split and inserted need to call
+ lock_update_insert() always. */
+ if (frame && btr_page_get_prev(frame, mtr) == FIL_NULL) {
+ inherit = TRUE;
+ }
}
#ifdef BTR_CUR_ADAPT
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 30b3a467183..26bab936de5 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -220,8 +220,12 @@ btr_defragment_add_index(
mtr_start(&mtr);
// Load index rood page.
- page_t* page = btr_page_get(space, zip_size, page_no,
- RW_NO_LATCH, index, &mtr);
+ buf_block_t* block = btr_block_get(space, zip_size, page_no, RW_NO_LATCH, index, &mtr);
+ page_t* page = NULL;
+
+ if (block) {
+ page = buf_block_get_frame(block);
+ }
if (page == NULL && index->table->is_encrypted) {
mtr_commit(&mtr);
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index d53b478e429..e6acb7802f1 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -750,9 +750,13 @@ btr_scrub_page(
mtr_t* mtr) /*!< in: mtr */
{
/* recheck if page needs scrubbing (knowing allocation status) */
- int needs_scrubbing = btr_page_needs_scrubbing(
- scrub_data, block, allocated);
- if (needs_scrubbing != BTR_SCRUB_PAGE) {
+ int needs_scrubbing = BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
+
+ if (block) {
+ btr_page_needs_scrubbing(scrub_data, block, allocated);
+ }
+
+ if (!block || needs_scrubbing != BTR_SCRUB_PAGE) {
mtr_commit(mtr);
return needs_scrubbing;
}
@@ -784,7 +788,12 @@ btr_scrub_page(
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
- if (btr_page_get_index_id(buf_block_get_frame(block)) !=
+ buf_frame_t* frame = NULL;
+
+ if (block) {
+ frame = buf_block_get_frame(block);
+ }
+ if (!frame || btr_page_get_index_id(frame) !=
scrub_data->current_index->id) {
/* page has been reallocated to new index */
mtr_commit(mtr);