MDEV-19783 Random crashes and corrupt data in INSTANT-added columns

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.
This commit is contained in:
Eugene Kosov 2019-09-30 20:58:50 +03:00 committed by Marko Mäkelä
parent d480d28f4f
commit 99dc40d6ac

View file

@ -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;
@ -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)) {
@ -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;