diff options
Diffstat (limited to 'src/backend/access/gist/gistsplit.c')
-rw-r--r-- | src/backend/access/gist/gistsplit.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c index a96b881cf1d..fd35dd2e52d 100644 --- a/src/backend/access/gist/gistsplit.c +++ b/src/backend/access/gist/gistsplit.c @@ -19,21 +19,21 @@ typedef struct { - Datum *attr; - int len; OffsetNumber *entries; + int len; + Datum *attr; bool *isnull; bool *equiv; } GistSplitUnion; /* - * Forms unions of subkeys after page split, but - * uses only tuples that aren't in groups of equivalent tuples + * Form unions of subkeys after a page split, ignoring any tuples + * that are marked in gsvp->equiv[] */ static void gistunionsubkeyvec(GISTSTATE *giststate, IndexTuple *itvec, - GistSplitUnion *gsvp, int startkey) + GistSplitUnion *gsvp) { IndexTuple *cleanedItVec; int i, @@ -49,35 +49,36 @@ gistunionsubkeyvec(GISTSTATE *giststate, IndexTuple *itvec, cleanedItVec[cleanedLen++] = itvec[gsvp->entries[i] - 1]; } - gistMakeUnionItVec(giststate, cleanedItVec, cleanedLen, startkey, + gistMakeUnionItVec(giststate, cleanedItVec, cleanedLen, gsvp->attr, gsvp->isnull); pfree(cleanedItVec); } /* - * unions subkeys for after user picksplit over attno-1 column + * Recompute unions of subkeys after a page split, ignoring any tuples + * that are marked in spl->spl_equiv[] */ static void -gistunionsubkey(GISTSTATE *giststate, IndexTuple *itvec, GistSplitVector *spl, int attno) +gistunionsubkey(GISTSTATE *giststate, IndexTuple *itvec, GistSplitVector *spl) { GistSplitUnion gsvp; gsvp.equiv = spl->spl_equiv; - gsvp.attr = spl->spl_lattr; - gsvp.len = spl->splitVector.spl_nleft; gsvp.entries = spl->splitVector.spl_left; + gsvp.len = spl->splitVector.spl_nleft; + gsvp.attr = spl->spl_lattr; gsvp.isnull = spl->spl_lisnull; - gistunionsubkeyvec(giststate, itvec, &gsvp, attno); + gistunionsubkeyvec(giststate, itvec, &gsvp); - gsvp.attr = spl->spl_rattr; - gsvp.len = spl->splitVector.spl_nright; gsvp.entries = spl->splitVector.spl_right; + gsvp.len = spl->splitVector.spl_nright; + gsvp.attr = spl->spl_rattr; gsvp.isnull = spl->spl_risnull; - gistunionsubkeyvec(giststate, itvec, &gsvp, attno); + gistunionsubkeyvec(giststate, itvec, &gsvp); } /* @@ -443,14 +444,14 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec */ if (LenEquiv == 0) { - gistunionsubkey(giststate, itup, v, attno + 1); + gistunionsubkey(giststate, itup, v); } else { cleanupOffsets(sv->spl_left, &sv->spl_nleft, v->spl_equiv, &LenEquiv); cleanupOffsets(sv->spl_right, &sv->spl_nright, v->spl_equiv, &LenEquiv); - gistunionsubkey(giststate, itup, v, attno + 1); + gistunionsubkey(giststate, itup, v); if (LenEquiv == 1) { /* @@ -471,7 +472,7 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec * performance, because it's very rarely */ v->spl_equiv = NULL; - gistunionsubkey(giststate, itup, v, attno + 1); + gistunionsubkey(giststate, itup, v); return false; } @@ -562,7 +563,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *gist v->splitVector.spl_left[v->splitVector.spl_nleft++] = i; v->spl_equiv = NULL; - gistunionsubkey(giststate, itup, v, attno); + gistunionsubkey(giststate, itup, v); } else { @@ -617,7 +618,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *gist v->splitVector = backupSplit; /* reunion left and right datums */ - gistunionsubkey(giststate, itup, v, attno); + gistunionsubkey(giststate, itup, v); } } } |