Skip to content

Commit 46cf3c7

Browse files
nbtree: Demote incomplete split "can't happen" error.
Only a basic logic bug in a _bt_insertonpg() caller could lead to a violation of this invariant (index corruption won't do it). A "can't happen" error seems inappropriate (it is arbitrary at best). Demote the error to a simple assertion. This matches similar nearby sanity checks.
1 parent ff94205 commit 46cf3c7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/backend/access/nbtree/nbtinsert.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,8 @@ _bt_insertonpg(Relation rel,
11291129
IndexRelationGetNumberOfKeyAttributes(rel));
11301130
Assert(!BTreeTupleIsPosting(itup));
11311131
Assert(MAXALIGN(IndexTupleSize(itup)) == itemsz);
1132+
/* Caller must always finish incomplete split for us */
1133+
Assert(!P_INCOMPLETE_SPLIT(lpageop));
11321134

11331135
/*
11341136
* Every internal page should have exactly one negative infinity item at
@@ -1138,11 +1140,6 @@ _bt_insertonpg(Relation rel,
11381140
*/
11391141
Assert(P_ISLEAF(lpageop) || newitemoff > P_FIRSTDATAKEY(lpageop));
11401142

1141-
/* The caller should've finished any incomplete splits already. */
1142-
if (P_INCOMPLETE_SPLIT(lpageop))
1143-
elog(ERROR, "cannot insert to incompletely split page %u",
1144-
BufferGetBlockNumber(buf));
1145-
11461143
/*
11471144
* Do we need to split an existing posting list item?
11481145
*/

0 commit comments

Comments
 (0)