Commit 99dc40d6 authored by Eugene Kosov's avatar Eugene Kosov Committed by Marko Mäkelä

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.
parent d480d28f
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment