amcheck: Fixes for right page check during unique constraint check
* Don't forget to pfree() the right page when it's to be ignored. * Report error on unexpected non-leaf right page even if this page is not to be ignored. This restores the logic which was unintendedly changed in 97e5b0026f. Reported-by: Pavel Borisov
This commit is contained in:
parent
4cf9aab214
commit
945ec4c4bc
@ -1901,17 +1901,19 @@ bt_target_page_check(BtreeCheckState *state)
|
|||||||
|
|
||||||
if (P_IGNORE(topaque))
|
if (P_IGNORE(topaque))
|
||||||
{
|
{
|
||||||
if (unlikely(!P_ISLEAF(topaque)))
|
pfree(rightpage);
|
||||||
ereport(ERROR,
|
break;
|
||||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
|
||||||
errmsg("right block of leaf block is non-leaf for index \"%s\"",
|
|
||||||
RelationGetRelationName(state->rel)),
|
|
||||||
errdetail_internal("Block=%u page lsn=%X/%X.",
|
|
||||||
state->targetblock,
|
|
||||||
LSN_FORMAT_ARGS(state->targetlsn))));
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely(!P_ISLEAF(topaque)))
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||||
|
errmsg("right block of leaf block is non-leaf for index \"%s\"",
|
||||||
|
RelationGetRelationName(state->rel)),
|
||||||
|
errdetail_internal("Block=%u page lsn=%X/%X.",
|
||||||
|
state->targetblock,
|
||||||
|
LSN_FORMAT_ARGS(state->targetlsn))));
|
||||||
|
|
||||||
itemid = PageGetItemIdCareful(state, rightblock_number,
|
itemid = PageGetItemIdCareful(state, rightblock_number,
|
||||||
rightpage,
|
rightpage,
|
||||||
rightfirstoffset);
|
rightfirstoffset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user