14 #ifndef GIST_PRIVATE_H 15 #define GIST_PRIVATE_H 39 #define GIST_MAX_SPLIT_PAGES 75 42 #define GIST_SHARE BUFFER_LOCK_SHARE 43 #define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE 44 #define GIST_UNLOCK BUFFER_LOCK_UNLOCK 53 #define BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) 55 #define PAGE_FREE_SPACE(nbp) (nbp->freespace) 57 #define PAGE_IS_EMPTY(nbp) (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) 59 #define PAGE_NO_SPACE(nbp, itup) (PAGE_FREE_SPACE(nbp) < \ 60 MAXALIGN(IndexTupleSize(itup))) 145 #define GISTSearchItemIsHeap(item) ((item).blkno == InvalidBlockNumber) 147 #define SizeOfGISTSearchItem(n_distances) \ 148 (offsetof(GISTSearchItem, distances) + \ 149 sizeof(IndexOrderByDistance) * (n_distances)) 262 #define GIST_ROOT_BLKNO 0 285 #define TUPLE_IS_VALID 0xffff 286 #define TUPLE_IS_INVALID 0xfffe 288 #define GistTupleIsInvalid(itup) ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) 289 #define GistTupleSetValid(itup) ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) 319 #define LEVEL_HAS_BUFFERS(nlevel, gfbb) \ 320 ((nlevel) != 0 && (nlevel) % (gfbb)->levelStep == 0 && \ 321 (nlevel) != (gfbb)->rootlevel) 324 #define BUFFER_HALF_FILLED(nodeBuffer, gfbb) \ 325 ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) 332 #define BUFFER_OVERFLOWED(nodeBuffer, gfbb) \ 333 ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) 431 bool markfollowright,
475 #define GiSTPageSize \ 476 ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) 478 #define GIST_MIN_FILLFACTOR 10 479 #define GIST_DEFAULT_FILLFACTOR 90 484 bool *res,
bool *isnull);
506 Datum *attdata,
bool *isnull,
bool isleaf,
Datum *compatt);
516 bool l,
bool isNull);
522 Datum *attr,
bool *isnull);
531 Datum *dst,
bool *dstisnull);
539 void *callback_state);
void gistinitpage(Page page, uint32 f)
void gistFreeBuildBuffers(GISTBuildBuffers *gfbb)
struct gistxlogPage gistxlogPage
void gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate, Relation heapRel, bool is_build)
bool gistPageRecyclable(Page page)
void gistbuildempty(Relation index)
Buffer gistNewBuffer(Relation r)
IndexOrderByDistance * distances
GistOptBufferingMode buffering_mode
HeapTuple gistFetchTuple(GISTSTATE *giststate, Relation r, IndexTuple tuple)
XLogRecPtr gistXLogSplit(bool page_is_leaf, SplitedPageLayout *dist, BlockNumber origrlink, GistNSN oldnsn, Buffer leftchild, bool markfollowright)
struct GISTSTATE GISTSTATE
void gistadjustmembers(Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)
bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, Buffer buffer, IndexTuple *itup, int ntup, OffsetNumber oldoffnum, BlockNumber *newblkno, Buffer leftchildbuf, List **splitinfo, bool markfollowright, Relation heapRel, bool is_build)
struct GISTSearchItem GISTSearchItem
OffsetNumber * killedItems
FmgrInfo fetchFn[INDEX_MAX_KEYS]
GISTNodeBuffer * gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate, BlockNumber blkno, int level)
IndexTuple gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate)
Oid supportCollation[INDEX_MAX_KEYS]
FmgrInfo compressFn[INDEX_MAX_KEYS]
void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull)
void gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate, GistSplitVector *v, int attno)
FmgrInfo equalFn[INDEX_MAX_KEYS]
MemoryContext createTempGistContext(void)
GIST_SPLITVEC splitVector
#define FLEXIBLE_ARRAY_MEMBER
void gistCompressValues(GISTSTATE *giststate, Relation r, Datum *attdata, bool *isnull, bool isleaf, Datum *compatt)
IndexBulkDeleteResult * gistbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
MemoryContext pageDataCxt
struct GiSTOptions GiSTOptions
bool gistvalidate(Oid opclassoid)
struct GISTScanOpaqueData GISTScanOpaqueData
XLogRecPtr gistXLogPageDelete(Buffer buffer, FullTransactionId xid, Buffer parentBuffer, OffsetNumber downlinkOffset)
GISTNodeBufferPage * pageBuffer
struct GistSplitVector GistSplitVector
FmgrInfo consistentFn[INDEX_MAX_KEYS]
List * bufferEmptyingQueue
void gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
GISTScanOpaqueData * GISTScanOpaque
void GISTInitBuffer(Buffer b, uint32 f)
void gistPushItupToNodeBuffer(GISTBuildBuffers *gfbb, GISTNodeBuffer *nodeBuffer, IndexTuple item)
float gistpenalty(GISTSTATE *giststate, int attno, GISTENTRY *key1, bool isNull1, GISTENTRY *key2, bool isNull2)
bool gistPopItupFromNodeBuffer(GISTBuildBuffers *gfbb, GISTNodeBuffer *nodeBuffer, IndexTuple *item)
XLogRecPtr gistGetFakeLSN(Relation rel)
FmgrInfo picksplitFn[INDEX_MAX_KEYS]
IndexTuple gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
FmgrInfo penaltyFn[INDEX_MAX_KEYS]
void gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate, Relation r, int level, Buffer buffer, List *splitinfo)
void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, OffsetNumber o, GISTENTRY *attdata, bool *isnull)
IndexBuildResult * gistbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
bool gistfitpage(IndexTuple *itvec, int len)
struct SplitedPageLayout * next
void gistXLogPageReuse(Relation rel, BlockNumber blkno, FullTransactionId latestRemovedXid)
GISTSTATE * initGISTstate(Relation index)
FmgrInfo decompressFn[INDEX_MAX_KEYS]
bool gistcanreturn(Relation index, int attno)
void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull)
bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)
OffsetNumber downlinkoffnum
IndexTuple * gistjoinvector(IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
bool gistproperty(Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull)
bool gistgettuple(IndexScanDesc scan, ScanDirection dir)
struct IndexTupleData IndexTupleData
bool gistnospace(Page page, IndexTuple *itvec, int len, OffsetNumber todelete, Size freespace)
GISTBuildBuffers * gistInitBuildBuffers(int pagesPerBuffer, int levelStep, int maxLevel)
SplitedPageLayout * gistSplit(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate)
XLogRecPtr gistXLogAssignLSN(void)
void freeGISTstate(GISTSTATE *giststate)
struct SplitedPageLayout SplitedPageLayout
bool gistinsert(Relation r, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, struct IndexInfo *indexInfo)
void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry1, bool isnull1, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull)
bytea * gistoptions(Datum reloptions, bool validate)
int64 gistgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
static const struct fns functions
FmgrInfo distanceFn[INDEX_MAX_KEYS]
void gistValidateBufferingOption(const char *value)
GISTNodeBuffer ** loadedBuffers
static Datum values[MAXATTR]
IndexTuple * gistextractpage(Page page, int *len)
struct GISTSearchHeapItem GISTSearchHeapItem
struct GISTBuildBuffers GISTBuildBuffers
XLogRecPtr gistXLogDelete(Buffer buffer, OffsetNumber *todelete, int ntodelete, TransactionId latestRemovedXid)
OffsetNumber gistchoose(Relation r, Page p, IndexTuple it, GISTSTATE *giststate)
IndexTupleData * gistfillitupvec(IndexTuple *vec, int veclen, int *memlen)
FmgrInfo unionFn[INDEX_MAX_KEYS]
struct GISTInsertStack * parent
struct GISTInsertStack GISTInsertStack
void gistcheckpage(Relation rel, Buffer buf)
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
void gistUnloadNodeBuffers(GISTBuildBuffers *gfbb)
IndexBulkDeleteResult * gistvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
XLogRecPtr gistXLogUpdate(Buffer buffer, OffsetNumber *todelete, int ntodelete, IndexTuple *itup, int ntup, Buffer leftchild)
IndexTuple gistFormTuple(GISTSTATE *giststate, Relation r, Datum *attdata, bool *isnull, bool isleaf)