Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/backend/access/gist/gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,13 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate)
GISTInsertStack *item;
OffsetNumber downlinkoffnum;

if(GistPageIsDeleted(stack->page))
{
UnlockReleaseBuffer(stack->buffer);
xlocked = false;
state.stack = stack = stack->parent;
continue;
}
downlinkoffnum = gistchoose(state.r, stack->page, itup, giststate);
iid = PageGetItemId(stack->page, downlinkoffnum);
idxtuple = (IndexTuple) PageGetItem(stack->page, iid);
Expand Down
5 changes: 0 additions & 5 deletions src/backend/access/gist/gistbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,11 +1126,6 @@ gistGetMaxLevel(Relation index)
* but will be added there the first time we visit them.
*/

typedef struct
{
BlockNumber childblkno; /* hash key */
BlockNumber parentblkno;
} ParentMapEntry;

static void
gistInitParentMap(GISTBuildState *buildstate)
Expand Down
4 changes: 3 additions & 1 deletion src/backend/access/gist/gistutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "storage/lmgr.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
#include "utils/snapmgr.h"


/*
Expand Down Expand Up @@ -801,13 +802,14 @@ gistNewBuffer(Relation r)
if (ConditionalLockBuffer(buffer))
{
Page page = BufferGetPage(buffer);
PageHeader p = (PageHeader) page;

if (PageIsNew(page))
return buffer; /* OK to use, if never initialized */

gistcheckpage(r, buffer);

if (GistPageIsDeleted(page))
if (GistPageIsDeleted(page) && TransactionIdPrecedes(p->pd_prune_xid, RecentGlobalDataXmin))
return buffer; /* OK to use */

LockBuffer(buffer, GIST_UNLOCK);
Expand Down
Loading