Skip to content

Commit

Permalink
MDEV-15528 fixup: Remove some dead code
Browse files Browse the repository at this point in the history
btr_page_split_and_insert(): Declare all parameters nonnull.
btr_pessimistic_scrub() was removed
in commit a5584b1 (MDEV-15528).
  • Loading branch information
dr-m committed Jun 6, 2022
1 parent 2f8d0af commit 1b03db1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
36 changes: 8 additions & 28 deletions storage/innobase/btr/btr0btr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2672,9 +2672,6 @@ released within this function! NOTE that the operation of this
function must always succeed, we cannot reverse it: therefore enough
free disk space (2 pages) must be guaranteed to be available before
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 */
rec_t*
btr_page_split_and_insert(
Expand Down Expand Up @@ -2746,7 +2743,7 @@ btr_page_split_and_insert(
uint32_t hint_page_no = block->page.id().page_no() + 1;
byte direction = FSP_UP;

if (tuple && n_iterations > 0) {
if (n_iterations > 0) {
split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);

if (split_rec == NULL) {
Expand Down Expand Up @@ -2816,8 +2813,7 @@ btr_page_split_and_insert(
? cursor->index->n_core_fields : 0,
n_uniq, heap);

insert_left = !tuple
|| cmp_dtuple_rec(tuple, split_rec, *offsets) < 0;
insert_left = cmp_dtuple_rec(tuple, split_rec, *offsets) < 0;

if (!insert_left && new_page_zip && n_iterations > 0) {
/* If a compressed page has already been split,
Expand Down Expand Up @@ -2853,22 +2849,12 @@ btr_page_split_and_insert(
on the appropriate half-page, we may release the tree x-latch.
We can then move the records after releasing the tree latch,
thus reducing the tree latch contention. */
bool insert_will_fit;
if (tuple == NULL) {
insert_will_fit = true;
} else if (split_rec) {
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);
buf = NULL;
}

insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, NULL,
offsets, tuple, n_ext, heap);
const bool insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, split_rec, offsets, tuple,
n_ext, heap);
if (!split_rec && !insert_left) {
UT_DELETE_ARRAY(buf);
buf = NULL;
}

if (!srv_read_only_mode
Expand Down Expand Up @@ -2992,11 +2978,6 @@ btr_page_split_and_insert(
buf_block_t* const insert_block = insert_left
? left_block : right_block;

if (UNIV_UNLIKELY(!tuple)) {
rec = NULL;
goto func_exit;
}

/* 7. Reposition the cursor for insert and try insertion */
page_cursor = btr_cur_get_page_cur(cursor);

Expand Down Expand Up @@ -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(right_block), cursor->index));

ut_ad(tuple || !rec);
ut_ad(!rec || rec_offs_validate(rec, cursor->index, *offsets));
return(rec);
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/btr0btr.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ btr_page_split_and_insert(
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
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
that mtr holds an x-latch on the tree. */
Expand Down

0 comments on commit 1b03db1

Please sign in to comment.