Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/backend/access/gist/gistbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ gistBuildCallback(Relation index,
itup = gistFormTuple(buildstate->giststate, index, values, isnull, true);
itup->t_tid = *tupleId;

/* Update tuple count and total size. */
buildstate->indtuples += 1;
buildstate->indtuplesSize += IndexTupleSize(itup);

/*
* XXX In buffering builds, the tempCxt is also reset down inside
* gistProcessEmptyingQueue(). This is not great because it risks
* confusion and possible use of dangling pointers (for example, itup
* might be already freed when control returns here). It's generally
* better that a memory context be "owned" by only one function. However,
* currently this isn't causing issues so it doesn't seem worth the amount
* of refactoring that would be needed to avoid it.
*/
if (buildstate->bufferingMode == GIST_BUFFERING_ACTIVE)
{
/* We have buffers, so use them. */
Expand All @@ -491,10 +504,6 @@ gistBuildCallback(Relation index,
buildstate->giststate);
}

/* Update tuple count and total size. */
buildstate->indtuples += 1;
buildstate->indtuplesSize += IndexTupleSize(itup);

MemoryContextSwitchTo(oldCtx);
MemoryContextReset(buildstate->giststate->tempCxt);

Expand Down
Loading