mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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.
This commit is contained in:
@ -908,6 +908,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup,
|
|||||||
* assume that suffix truncation neither enlarges nor shrinks new high key
|
* assume that suffix truncation neither enlarges nor shrinks new high key
|
||||||
* when applying soft limit, except when last tuple has a posting list.)
|
* 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) ||
|
if (pgspc < itupsz + (isleaf ? MAXALIGN(sizeof(ItemPointerData)) : 0) ||
|
||||||
(pgspc + last_truncextra < state->btps_full && last_off > P_FIRSTKEY))
|
(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));
|
ii = PageGetItemId(opage, OffsetNumberPrev(last_off));
|
||||||
lastleft = (IndexTuple) PageGetItem(opage, ii);
|
lastleft = (IndexTuple) PageGetItem(opage, ii);
|
||||||
|
|
||||||
|
Assert(IndexTupleSize(oitup) > last_truncextra);
|
||||||
truncated = _bt_truncate(wstate->index, lastleft, oitup,
|
truncated = _bt_truncate(wstate->index, lastleft, oitup,
|
||||||
wstate->inskey);
|
wstate->inskey);
|
||||||
if (!PageIndexTupleOverwrite(opage, P_HIKEY, (Item) truncated,
|
if (!PageIndexTupleOverwrite(opage, P_HIKEY, (Item) truncated,
|
||||||
|
Reference in New Issue
Block a user