Skip to content

Commit

Permalink
MDEV-19783 Random crashes and corrupt data in INSTANT-added columns
Browse files Browse the repository at this point in the history
The bug affects MariaDB Server 10.3 or later, but it makes sense
to improve CHECK TABLE in earlier versions already.

page_validate(): Check REC_INFO_MIN_REC_FLAG in the records.
This allows CHECK TABLE to catch more bugs.
  • Loading branch information
kevgs authored and dr-m committed Oct 9, 2019
1 parent d480d28 commit 99dc40d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions storage/innobase/page/page0page.cc
Expand Up @@ -2392,6 +2392,7 @@ page_validate(
ulint data_size;
const rec_t* rec;
const rec_t* old_rec = NULL;
const rec_t* first_rec = NULL;
ulint offs;
ulint n_slots;
ibool ret = FALSE;
Expand Down Expand Up @@ -2488,6 +2489,21 @@ page_validate(
goto func_exit;
}

if (rec == first_rec) {
if ((rec_get_info_bits(rec, page_is_comp(page))
& REC_INFO_MIN_REC_FLAG)
&& page_is_leaf(page)) {
ib::error() << "REC_INFO_MIN_REC_FLAG "
"is set in a leaf-page record";
ret = false;
}
} else if (rec_get_info_bits(rec, page_is_comp(page))
& REC_INFO_MIN_REC_FLAG) {
ib::error() << "REC_INFO_MIN_REC_FLAG record is not "
"first in page";
ret = false;
}

/* Check that the records are in the ascending order */
if (count >= PAGE_HEAP_NO_USER_LOW
&& !page_rec_is_supremum(rec)) {
Expand Down Expand Up @@ -2599,6 +2615,11 @@ page_validate(
old_rec = rec;
rec = page_rec_get_next_const(rec);

if (page_rec_is_infimum(old_rec)
&& page_rec_is_user_rec(rec)) {
first_rec = rec;
}

/* set old_offsets to offsets; recycle offsets */
{
ulint* offs = old_offsets;
Expand Down

0 comments on commit 99dc40d

Please sign in to comment.