18 #include "catalog/pg_am_d.h"
33 #define GIN_DEFAULT_USE_FASTUPDATE true
34 #define GinGetUseFastUpdate(relation) \
35 (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
36 relation->rd_rel->relam == GIN_AM_OID), \
37 (relation)->rd_options ? \
38 ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE)
39 #define GinGetPendingListCleanupSize(relation) \
40 (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \
41 relation->rd_rel->relam == GIN_AM_OID), \
42 (relation)->rd_options && \
43 ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize != -1 ? \
44 ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize : \
45 gin_pending_list_limit)
49 #define GIN_UNLOCK BUFFER_LOCK_UNLOCK
50 #define GIN_SHARE BUFFER_LOCK_SHARE
51 #define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE
206 bool rootConflictCheck);
391 ScanKey orderbys,
int norderbys);
405 void *callback_state);
473 int maxsize,
int *nwritten);
static Datum values[MAXATTR]
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
int ginTraverseLock(Buffer buffer, bool searchMode)
IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys)
struct GinScanKeyData GinScanKeyData
void freeGinBtreeStack(GinBtreeStack *stack)
ItemPointer ginPostingListDecodeAllSegments(GinPostingList *segment, int len, int *ndecoded_out)
void ginBeginBAScan(BuildAccumulator *accum)
void ginInsertValue(GinBtree btree, GinBtreeStack *stack, void *insertdata, GinStatsData *buildStats)
GinScanOpaqueData * GinScanOpaque
void GinInitPage(Page page, uint32 f, Size pageSize)
struct GinOptions GinOptions
int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
IndexBuildResult * ginbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
void ginInsertCleanup(GinState *ginstate, bool full_clean, bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats)
void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid)
void ginFreeScanKeys(GinScanOpaque so)
GinBtreeStack * ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno)
IndexBulkDeleteResult * ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
Buffer GinNewBuffer(Relation index)
BlockNumber createPostingTree(Relation index, ItemPointerData *items, uint32 nitems, GinStatsData *buildStats, Buffer entrybuffer)
GinPostingList * ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize, int *nwritten)
bool ginvalidate(Oid opclassoid)
int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int len, TIDBitmap *tbm)
void GinInitBuffer(Buffer b, uint32 f)
void ginEntryInsert(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
void ginendscan(IndexScanDesc scan)
void ginNewScanKey(IndexScanDesc scan)
void ginInsertBAEntries(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, GinNullCategory *categories, int32 nentries)
struct GinScanOpaqueData GinScanOpaqueData
void ginrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
void GinPageDeletePostingItem(Page page, OffsetNumber offset)
ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, ItemPointerData *items, int nitem, int *nremaining)
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
struct GinScanEntryData * GinScanEntry
bool gininsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, struct IndexInfo *indexInfo)
struct GinBtreeStack GinBtreeStack
ItemPointer ginPostingListDecode(GinPostingList *plist, int *ndecoded_out)
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
struct GinBtreeData GinBtreeData
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
struct GinBtreeData * GinBtree
void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset)
void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
IndexBulkDeleteResult * ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
void GinInitMetabuffer(Buffer b)
void ginInitBA(BuildAccumulator *accum)
void ginbuildempty(Relation index)
void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
void initGinState(GinState *state, Relation index)
bytea * ginoptions(Datum reloptions, bool validate)
struct GinScanKeyData * GinScanKey
ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, IndexTuple itup, int *nitems)
struct GinEntryAccumulator GinEntryAccumulator
ItemPointerData * ginGetBAEntry(BuildAccumulator *accum, OffsetNumber *attnum, Datum *key, GinNullCategory *category, uint32 *n)
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
void ginadjustmembers(Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)
void ginVacuumPostingTreeLeaf(Relation indexrel, Buffer buffer, GinVacuumState *gvs)
IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, Pointer data, Size dataSize, int nipd, bool errorTooBig)
void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate)
struct GinTupleCollector GinTupleCollector
ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb, int *nmerged)
void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Buffer ginStepRight(Buffer buffer, Relation index, int lockmode)
GinBtreeStack * ginFindLeafPage(GinBtree btree, bool searchMode, bool rootConflictCheck)
ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast)
struct GinScanEntryData GinScanEntryData
#define GinItemPointerGetOffsetNumber(pointer)
signed char GinNullCategory
#define GinItemPointerGetBlockNumber(pointer)
static int pg_cmp_u64(uint64 a, uint64 b)
static const struct fns functions
GinEntryAccumulator * entryallocator
BlockNumber(* findChildPage)(GinBtree, GinBtreeStack *)
void(* execPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *)
BlockNumber(* getLeftMostChild)(GinBtree, Page)
bool(* findItem)(GinBtree, GinBtreeStack *)
bool(* isMoveRight)(GinBtree, Page)
GinPlaceToPageRC(* beginPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *)
GinNullCategory entryCategory
OffsetNumber(* findChildPtr)(GinBtree, Page, BlockNumber, OffsetNumber)
void(* fillRoot)(GinBtree, Page, BlockNumber, Page, BlockNumber, Page)
struct GinBtreeStack * parent
int pendingListCleanupSize
TBMIterateResult * matchResult
GinNullCategory queryCategory
TBMIterator * matchIterator
uint32 predictNumberResult
GinScanEntry * additionalEntries
GinScanEntry * requiredEntries
FmgrInfo * triConsistentFmgrInfo
GinNullCategory * queryCategories
FmgrInfo * consistentFmgrInfo
GinTernaryValue * entryRes
GinTernaryValue(* triConsistentFn)(GinScanKey key)
bool(* boolConsistentFn)(GinScanKey key)
FmgrInfo comparePartialFn[INDEX_MAX_KEYS]
FmgrInfo extractQueryFn[INDEX_MAX_KEYS]
TupleDesc tupdesc[INDEX_MAX_KEYS]
FmgrInfo triConsistentFn[INDEX_MAX_KEYS]
FmgrInfo extractValueFn[INDEX_MAX_KEYS]
FmgrInfo consistentFn[INDEX_MAX_KEYS]
Oid supportCollation[INDEX_MAX_KEYS]
bool canPartialMatch[INDEX_MAX_KEYS]
FmgrInfo compareFn[INDEX_MAX_KEYS]
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)