Skip to content

Commit

Permalink
MDEV-19783: Add more assertions
Browse files Browse the repository at this point in the history
btr_page_get_split_rec_to_left(): Assert that in the leftmost leaf page,
the metadata record exists if and only if index->is_instant().

page_validate(): Correct the wording of a message.

rec_init_offsets(): Assert that whenever a record is in "instant ALTER"
format, index->is_instant() must hold.
  • Loading branch information
dr-m committed Oct 10, 2019
1 parent 7f84e3a commit 01f45be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion storage/innobase/btr/btr0btr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,14 @@ rec_t* btr_page_get_split_rec_to_left(const btr_cur_t* cursor)
return NULL;
}

/* The metadata record must be present in the leftmost leaf page
of the clustered index, if and only if index->is_instant(). */
ut_ad(!page_is_leaf(page) || page_has_prev(page)
|| cursor->index->is_instant()
== rec_is_metadata(page_rec_get_next_const(
page_get_infimum_rec(page)),
cursor->index));

const rec_t* infimum = page_get_infimum_rec(page);

/* If the convergence is in the middle of a page, include also
Expand Down Expand Up @@ -2783,7 +2791,7 @@ btr_page_split_and_insert(
ulint n_iterations = 0;
ulint n_uniq;

if (dict_index_is_spatial(cursor->index)) {
if (cursor->index->is_spatial()) {
/* Split rtree page and update parent */
return(rtr_page_split_and_insert(flags, cursor, offsets, heap,
tuple, n_ext, mtr));
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/page/page0page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ page_copy_rec_list_start(
const bool is_leaf = page_rec_is_leaf(rec);

/* Copy records from the original page to the new page */
if (dict_index_is_spatial(index)) {
if (index->is_spatial()) {
ut_ad(!index->is_instant());
ulint max_to_move = page_get_n_recs(
buf_block_get_frame(block));
heap = mem_heap_create(256);
Expand Down Expand Up @@ -2535,7 +2536,7 @@ bool page_validate(const page_t* page, const dict_index_t* index)
& REC_INFO_MIN_REC_FLAG)) {
if (page_has_prev(page)) {
ib::error() << "REC_INFO_MIN_REC_FLAG "
"is set in on non-left page";
"is set on non-left page";
ret = false;
} else if (!page_is_leaf(page)) {
/* leftmost node pointer page */
Expand Down
3 changes: 3 additions & 0 deletions storage/innobase/rem/rem0rec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ rec_init_offsets(
break;
case REC_STATUS_COLUMNS_ADDED:
ut_ad(leaf);
ut_ad(index->is_instant());
rec_init_offsets_comp_ordinary(rec, index, offsets,
index->n_core_fields,
NULL,
Expand Down Expand Up @@ -741,6 +742,8 @@ rec_init_offsets(
}

if (i < rec_offs_n_fields(offsets)) {
ut_ad(index->is_instant());

offs = (rec_offs_base(offsets)[i] & REC_OFFS_MASK)
| REC_OFFS_DEFAULT;

Expand Down

0 comments on commit 01f45be

Please sign in to comment.