Skip to content

Commit 01f45be

Browse files
committed
MDEV-19783: Add more assertions
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.
1 parent 7f84e3a commit 01f45be

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

storage/innobase/btr/btr0btr.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,14 @@ rec_t* btr_page_get_split_rec_to_left(const btr_cur_t* cursor)
20622062
return NULL;
20632063
}
20642064

2065+
/* The metadata record must be present in the leftmost leaf page
2066+
of the clustered index, if and only if index->is_instant(). */
2067+
ut_ad(!page_is_leaf(page) || page_has_prev(page)
2068+
|| cursor->index->is_instant()
2069+
== rec_is_metadata(page_rec_get_next_const(
2070+
page_get_infimum_rec(page)),
2071+
cursor->index));
2072+
20652073
const rec_t* infimum = page_get_infimum_rec(page);
20662074

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

2786-
if (dict_index_is_spatial(cursor->index)) {
2794+
if (cursor->index->is_spatial()) {
27872795
/* Split rtree page and update parent */
27882796
return(rtr_page_split_and_insert(flags, cursor, offsets, heap,
27892797
tuple, n_ext, mtr));

storage/innobase/page/page0page.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,8 @@ page_copy_rec_list_start(
839839
const bool is_leaf = page_rec_is_leaf(rec);
840840

841841
/* Copy records from the original page to the new page */
842-
if (dict_index_is_spatial(index)) {
842+
if (index->is_spatial()) {
843+
ut_ad(!index->is_instant());
843844
ulint max_to_move = page_get_n_recs(
844845
buf_block_get_frame(block));
845846
heap = mem_heap_create(256);
@@ -2535,7 +2536,7 @@ bool page_validate(const page_t* page, const dict_index_t* index)
25352536
& REC_INFO_MIN_REC_FLAG)) {
25362537
if (page_has_prev(page)) {
25372538
ib::error() << "REC_INFO_MIN_REC_FLAG "
2538-
"is set in on non-left page";
2539+
"is set on non-left page";
25392540
ret = false;
25402541
} else if (!page_is_leaf(page)) {
25412542
/* leftmost node pointer page */

storage/innobase/rem/rem0rec.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ rec_init_offsets(
600600
break;
601601
case REC_STATUS_COLUMNS_ADDED:
602602
ut_ad(leaf);
603+
ut_ad(index->is_instant());
603604
rec_init_offsets_comp_ordinary(rec, index, offsets,
604605
index->n_core_fields,
605606
NULL,
@@ -741,6 +742,8 @@ rec_init_offsets(
741742
}
742743

743744
if (i < rec_offs_n_fields(offsets)) {
745+
ut_ad(index->is_instant());
746+
744747
offs = (rec_offs_base(offsets)[i] & REC_OFFS_MASK)
745748
| REC_OFFS_DEFAULT;
746749

0 commit comments

Comments
 (0)