Skip to content

Commit 7dbe290

Browse files
Add CREATE INDEX deduplication assertions.
Add two assertions that verify the assumptions about posting list tuple space accounting and suffix truncation made within nbtsort.c.
1 parent c2da793 commit 7dbe290

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/access/nbtree/nbtsort.c

+2
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup,
908908
* assume that suffix truncation neither enlarges nor shrinks new high key
909909
* when applying soft limit, except when last tuple has a posting list.)
910910
*/
911+
Assert(last_truncextra == 0 || isleaf);
911912
if (pgspc < itupsz + (isleaf ? MAXALIGN(sizeof(ItemPointerData)) : 0) ||
912913
(pgspc + last_truncextra < state->btps_full && last_off > P_FIRSTKEY))
913914
{
@@ -983,6 +984,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup,
983984
ii = PageGetItemId(opage, OffsetNumberPrev(last_off));
984985
lastleft = (IndexTuple) PageGetItem(opage, ii);
985986

987+
Assert(IndexTupleSize(oitup) > last_truncextra);
986988
truncated = _bt_truncate(wstate->index, lastleft, oitup,
987989
wstate->inskey);
988990
if (!PageIndexTupleOverwrite(opage, P_HIKEY, (Item) truncated,

0 commit comments

Comments
 (0)