diff options
author | Peter Geoghegan | 2020-03-31 21:38:39 +0000 |
---|---|---|
committer | Peter Geoghegan | 2020-03-31 21:38:39 +0000 |
commit | 7dbe290da446544a04ace7d342841070f062a0ed (patch) | |
tree | 17b582c84ec8a88015e661ae33a930a34c9490b9 /src | |
parent | c2da793fd28073603c39d7abfffbc203a9bd4ac0 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/nbtree/nbtsort.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index e66cd36dfae..3924945664a 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -908,6 +908,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup, * assume that suffix truncation neither enlarges nor shrinks new high key * when applying soft limit, except when last tuple has a posting list.) */ + Assert(last_truncextra == 0 || isleaf); if (pgspc < itupsz + (isleaf ? MAXALIGN(sizeof(ItemPointerData)) : 0) || (pgspc + last_truncextra < state->btps_full && last_off > P_FIRSTKEY)) { @@ -983,6 +984,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup, ii = PageGetItemId(opage, OffsetNumberPrev(last_off)); lastleft = (IndexTuple) PageGetItem(opage, ii); + Assert(IndexTupleSize(oitup) > last_truncextra); truncated = _bt_truncate(wstate->index, lastleft, oitup, wstate->inskey); if (!PageIndexTupleOverwrite(opage, P_HIKEY, (Item) truncated, |