Commit 1b03db11 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15528 fixup: Remove some dead code

btr_page_split_and_insert(): Declare all parameters nonnull.
btr_pessimistic_scrub() was removed
in commit a5584b13 (MDEV-15528).
parent 2f8d0af8
...@@ -2672,9 +2672,6 @@ released within this function! NOTE that the operation of this ...@@ -2672,9 +2672,6 @@ released within this function! NOTE that the operation of this
function must always succeed, we cannot reverse it: therefore enough function must always succeed, we cannot reverse it: therefore enough
free disk space (2 pages) must be guaranteed to be available before free disk space (2 pages) must be guaranteed to be available before
this function is called. this function is called.
NOTE: jonaso added support for calling function with tuple == NULL
which cause it to only split a page.
@return inserted record or NULL if run out of space */ @return inserted record or NULL if run out of space */
rec_t* rec_t*
btr_page_split_and_insert( btr_page_split_and_insert(
...@@ -2746,7 +2743,7 @@ btr_page_split_and_insert( ...@@ -2746,7 +2743,7 @@ btr_page_split_and_insert(
uint32_t hint_page_no = block->page.id().page_no() + 1; uint32_t hint_page_no = block->page.id().page_no() + 1;
byte direction = FSP_UP; byte direction = FSP_UP;
if (tuple && n_iterations > 0) { if (n_iterations > 0) {
split_rec = btr_page_get_split_rec(cursor, tuple, n_ext); split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);
if (split_rec == NULL) { if (split_rec == NULL) {
...@@ -2816,8 +2813,7 @@ btr_page_split_and_insert( ...@@ -2816,8 +2813,7 @@ btr_page_split_and_insert(
? cursor->index->n_core_fields : 0, ? cursor->index->n_core_fields : 0,
n_uniq, heap); n_uniq, heap);
insert_left = !tuple insert_left = cmp_dtuple_rec(tuple, split_rec, *offsets) < 0;
|| cmp_dtuple_rec(tuple, split_rec, *offsets) < 0;
if (!insert_left && new_page_zip && n_iterations > 0) { if (!insert_left && new_page_zip && n_iterations > 0) {
/* If a compressed page has already been split, /* If a compressed page has already been split,
...@@ -2853,24 +2849,14 @@ btr_page_split_and_insert( ...@@ -2853,24 +2849,14 @@ btr_page_split_and_insert(
on the appropriate half-page, we may release the tree x-latch. on the appropriate half-page, we may release the tree x-latch.
We can then move the records after releasing the tree latch, We can then move the records after releasing the tree latch,
thus reducing the tree latch contention. */ thus reducing the tree latch contention. */
bool insert_will_fit; const bool insert_will_fit = !new_page_zip
if (tuple == NULL) { && btr_page_insert_fits(cursor, split_rec, offsets, tuple,
insert_will_fit = true; n_ext, heap);
} else if (split_rec) { if (!split_rec && !insert_left) {
insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, split_rec,
offsets, tuple, n_ext, heap);
} else {
if (!insert_left) {
UT_DELETE_ARRAY(buf); UT_DELETE_ARRAY(buf);
buf = NULL; buf = NULL;
} }
insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, NULL,
offsets, tuple, n_ext, heap);
}
if (!srv_read_only_mode if (!srv_read_only_mode
&& insert_will_fit && insert_will_fit
&& page_is_leaf(page) && page_is_leaf(page)
...@@ -2992,11 +2978,6 @@ btr_page_split_and_insert( ...@@ -2992,11 +2978,6 @@ btr_page_split_and_insert(
buf_block_t* const insert_block = insert_left buf_block_t* const insert_block = insert_left
? left_block : right_block; ? left_block : right_block;
if (UNIV_UNLIKELY(!tuple)) {
rec = NULL;
goto func_exit;
}
/* 7. Reposition the cursor for insert and try insertion */ /* 7. Reposition the cursor for insert and try insertion */
page_cursor = btr_cur_get_page_cur(cursor); page_cursor = btr_cur_get_page_cur(cursor);
...@@ -3073,7 +3054,6 @@ btr_page_split_and_insert( ...@@ -3073,7 +3054,6 @@ btr_page_split_and_insert(
ut_ad(page_validate(buf_block_get_frame(left_block), cursor->index)); ut_ad(page_validate(buf_block_get_frame(left_block), cursor->index));
ut_ad(page_validate(buf_block_get_frame(right_block), cursor->index)); ut_ad(page_validate(buf_block_get_frame(right_block), cursor->index));
ut_ad(tuple || !rec);
ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets)); ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets));
return(rec); return(rec);
} }
......
...@@ -438,7 +438,7 @@ btr_page_split_and_insert( ...@@ -438,7 +438,7 @@ btr_page_split_and_insert(
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/*******************************************************//** /*******************************************************//**
Inserts a data tuple to a tree on a non-leaf level. It is assumed Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */ that mtr holds an x-latch on the tree. */
......
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