Skip to content

Commit a4cb21e

Browse files
committed
Fix amcheck's handling of incomplete root splits in B-tree
When the root page is being split, it's normal that root page according to the metapage is not marked BTP_ROOT. Fix bogus error in amcheck about that case. Reviewed-by: Peter Geoghegan <pg@bowt.ie> Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi Backpatch-through: 14
1 parent 2d5b97b commit a4cb21e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
784784
errmsg("block %u is not leftmost in index \"%s\"",
785785
current, RelationGetRelationName(state->rel))));
786786

787-
if (level.istruerootlevel && !P_ISROOT(opaque))
787+
if (level.istruerootlevel && (!P_ISROOT(opaque) && !P_INCOMPLETE_SPLIT(opaque)))
788788
ereport(ERROR,
789789
(errcode(ERRCODE_INDEX_CORRUPTED),
790790
errmsg("block %u is not true root in index \"%s\"",

0 commit comments

Comments
 (0)