Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 945ec4c

Browse files
committed
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 97e5b00. Reported-by: Pavel Borisov
1 parent 4cf9aab commit 945ec4c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,17 +1901,19 @@ bt_target_page_check(BtreeCheckState *state)
19011901

19021902
if (P_IGNORE(topaque))
19031903
{
1904-
if (unlikely(!P_ISLEAF(topaque)))
1905-
ereport(ERROR,
1906-
(errcode(ERRCODE_INDEX_CORRUPTED),
1907-
errmsg("right block of leaf block is non-leaf for index \"%s\"",
1908-
RelationGetRelationName(state->rel)),
1909-
errdetail_internal("Block=%u page lsn=%X/%X.",
1910-
state->targetblock,
1911-
LSN_FORMAT_ARGS(state->targetlsn))));
1912-
else
1913-
break;
1904+
pfree(rightpage);
1905+
break;
19141906
}
1907+
1908+
if (unlikely(!P_ISLEAF(topaque)))
1909+
ereport(ERROR,
1910+
(errcode(ERRCODE_INDEX_CORRUPTED),
1911+
errmsg("right block of leaf block is non-leaf for index \"%s\"",
1912+
RelationGetRelationName(state->rel)),
1913+
errdetail_internal("Block=%u page lsn=%X/%X.",
1914+
state->targetblock,
1915+
LSN_FORMAT_ARGS(state->targetlsn))));
1916+
19151917
itemid = PageGetItemIdCareful(state, rightblock_number,
19161918
rightpage,
19171919
rightfirstoffset);

0 commit comments

Comments
 (0)