PostgreSQL Source Code  git master
gin_private.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------
2  * gin_private.h
3  * header file for postgres inverted index access method implementation.
4  *
5  * Copyright (c) 2006-2018, PostgreSQL Global Development Group
6  *
7  * src/include/access/gin_private.h
8  *--------------------------------------------------------------------------
9  */
10 #ifndef GIN_PRIVATE_H
11 #define GIN_PRIVATE_H
12 
13 #include "access/amapi.h"
14 #include "access/gin.h"
15 #include "access/ginblock.h"
16 #include "access/itup.h"
17 #include "fmgr.h"
18 #include "storage/bufmgr.h"
19 #include "lib/rbtree.h"
20 
21 /*
22  * Storage type for GIN's reloptions
23  */
24 typedef struct GinOptions
25 {
26  int32 vl_len_; /* varlena header (do not touch directly!) */
27  bool useFastUpdate; /* use fast updates? */
28  int pendingListCleanupSize; /* maximum size of pending list */
29 } GinOptions;
30 
31 #define GIN_DEFAULT_USE_FASTUPDATE true
32 #define GinGetUseFastUpdate(relation) \
33  ((relation)->rd_options ? \
34  ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE)
35 #define GinGetPendingListCleanupSize(relation) \
36  ((relation)->rd_options && \
37  ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize != -1 ? \
38  ((GinOptions *) (relation)->rd_options)->pendingListCleanupSize : \
39  gin_pending_list_limit)
40 
41 
42 /* Macros for buffer lock/unlock operations */
43 #define GIN_UNLOCK BUFFER_LOCK_UNLOCK
44 #define GIN_SHARE BUFFER_LOCK_SHARE
45 #define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE
46 
47 
48 /*
49  * GinState: working data structure describing the index being worked on
50  */
51 typedef struct GinState
52 {
54  bool oneCol; /* true if single-column index */
55 
56  /*
57  * origTupDesc is the nominal tuple descriptor of the index, ie, the i'th
58  * attribute shows the key type (not the input data type!) of the i'th
59  * index column. In a single-column index this describes the actual leaf
60  * index tuples. In a multi-column index, the actual leaf tuples contain
61  * a smallint column number followed by a key datum of the appropriate
62  * type for that column. We set up tupdesc[i] to describe the actual
63  * rowtype of the index tuples for the i'th column, ie, (int2, keytype).
64  * Note that in any case, leaf tuples contain more data than is known to
65  * the TupleDesc; see access/gin/README for details.
66  */
69 
70  /*
71  * Per-index-column opclass support functions
72  */
74  FmgrInfo extractValueFn[INDEX_MAX_KEYS];
75  FmgrInfo extractQueryFn[INDEX_MAX_KEYS];
76  FmgrInfo consistentFn[INDEX_MAX_KEYS];
77  FmgrInfo triConsistentFn[INDEX_MAX_KEYS];
78  FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */
79  /* canPartialMatch[i] is true if comparePartialFn[i] is valid */
80  bool canPartialMatch[INDEX_MAX_KEYS];
81  /* Collations to pass to the support functions */
82  Oid supportCollation[INDEX_MAX_KEYS];
83 } GinState;
84 
85 
86 /* ginutil.c */
87 extern bytea *ginoptions(Datum reloptions, bool validate);
90 extern void GinInitBuffer(Buffer b, uint32 f);
91 extern void GinInitPage(Page page, uint32 f, Size pageSize);
92 extern void GinInitMetabuffer(Buffer b);
93 extern int ginCompareEntries(GinState *ginstate, OffsetNumber attnum,
94  Datum a, GinNullCategory categorya,
95  Datum b, GinNullCategory categoryb);
96 extern int ginCompareAttEntries(GinState *ginstate,
97  OffsetNumber attnuma, Datum a, GinNullCategory categorya,
98  OffsetNumber attnumb, Datum b, GinNullCategory categoryb);
100  Datum value, bool isNull,
101  int32 *nentries, GinNullCategory **categories);
102 
103 extern OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple);
104 extern Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple,
105  GinNullCategory *category);
106 extern void GinCheckForSerializableConflictIn(Relation relation,
107  HeapTuple tuple, Buffer buffer);
108 
109 /* gininsert.c */
111  struct IndexInfo *indexInfo);
112 extern void ginbuildempty(Relation index);
113 extern bool gininsert(Relation index, Datum *values, bool *isnull,
114  ItemPointer ht_ctid, Relation heapRel,
115  IndexUniqueCheck checkUnique,
116  struct IndexInfo *indexInfo);
117 extern void ginEntryInsert(GinState *ginstate,
118  OffsetNumber attnum, Datum key, GinNullCategory category,
119  ItemPointerData *items, uint32 nitem,
120  GinStatsData *buildStats);
121 
122 /* ginbtree.c */
123 
124 typedef struct GinBtreeStack
125 {
130  /* predictNumber contains predicted number of pages on current level */
133 } GinBtreeStack;
134 
135 typedef struct GinBtreeData *GinBtree;
136 
137 /* Return codes for GinBtreeData.beginPlaceToPage method */
138 typedef enum
139 {
144 
145 typedef struct GinBtreeData
146 {
147  /* search methods */
148  BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *);
149  BlockNumber (*getLeftMostChild) (GinBtree, Page);
150  bool (*isMoveRight) (GinBtree, Page);
151  bool (*findItem) (GinBtree, GinBtreeStack *);
152 
153  /* insert methods */
155  GinPlaceToPageRC (*beginPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *);
156  void (*execPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *);
157  void *(*prepareDownlink) (GinBtree, Buffer);
158  void (*fillRoot) (GinBtree, Page, BlockNumber, Page, BlockNumber, Page);
159 
160  bool isData;
161 
163  BlockNumber rootBlkno;
164  GinState *ginstate; /* not valid in a data scan */
165  bool fullScan;
166  bool isBuild;
167 
168  /* Search key for Entry tree */
172 
173  /* Search key for data tree (posting tree) */
175 } GinBtreeData;
176 
177 /* This represents a tuple to be inserted to entry tree. */
178 typedef struct
179 {
180  IndexTuple entry; /* tuple to insert */
181  bool isDelete; /* delete old tuple at same offset? */
183 
184 /*
185  * This represents an itempointer, or many itempointers, to be inserted to
186  * a data (posting tree) leaf page
187  */
188 typedef struct
189 {
194 
195 /*
196  * For internal data (posting tree) pages, the insertion payload is a
197  * PostingItem
198  */
199 
200 extern GinBtreeStack *ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot);
201 extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode);
202 extern void freeGinBtreeStack(GinBtreeStack *stack);
203 extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack,
204  void *insertdata, GinStatsData *buildStats);
205 
206 /* ginentrypage.c */
207 extern IndexTuple GinFormTuple(GinState *ginstate,
208  OffsetNumber attnum, Datum key, GinNullCategory category,
209  Pointer data, Size dataSize, int nipd, bool errorTooBig);
210 extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
211  Datum key, GinNullCategory category,
212  GinState *ginstate);
213 extern void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
215  IndexTuple itup, int *nitems);
216 
217 /* gindatapage.c */
218 extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast);
219 extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm);
221  ItemPointerData *items, uint32 nitems,
222  GinStatsData *buildStats, Buffer entrybuffer);
223 extern void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset);
224 extern void GinPageDeletePostingItem(Page page, OffsetNumber offset);
225 extern void ginInsertItemPointers(Relation index, BlockNumber rootBlkno,
226  ItemPointerData *items, uint32 nitem,
227  GinStatsData *buildStats);
228 extern GinBtreeStack *ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot);
229 extern void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
230 extern void ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno);
231 
232 /*
233  * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers
234  * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward
235  * declaration for it.
236  */
238 
240 
241 /* ginscan.c */
242 
243 /*
244  * GinScanKeyData describes a single GIN index qualifier expression.
245  *
246  * From each qual expression, we extract one or more specific index search
247  * conditions, which are represented by GinScanEntryData. It's quite
248  * possible for identical search conditions to be requested by more than
249  * one qual expression, in which case we merge such conditions to have just
250  * one unique GinScanEntry --- this is particularly important for efficiency
251  * when dealing with full-index-scan entries. So there can be multiple
252  * GinScanKeyData.scanEntry pointers to the same GinScanEntryData.
253  *
254  * In each GinScanKeyData, nentries is the true number of entries, while
255  * nuserentries is the number that extractQueryFn returned (which is what
256  * we report to consistentFn). The "user" entries must come first.
257  */
258 typedef struct GinScanKeyData *GinScanKey;
259 
261 
262 typedef struct GinScanKeyData
263 {
264  /* Real number of entries in scanEntry[] (always > 0) */
266  /* Number of entries that extractQueryFn and consistentFn know about */
268 
269  /* array of GinScanEntry pointers, one per extracted search condition */
270  GinScanEntry *scanEntry;
271 
272  /*
273  * At least one of the entries in requiredEntries must be present for a
274  * tuple to match the overall qual.
275  *
276  * additionalEntries contains entries that are needed by the consistent
277  * function to decide if an item matches, but are not sufficient to
278  * satisfy the qual without entries from requiredEntries.
279  */
280  GinScanEntry *requiredEntries;
282  GinScanEntry *additionalEntries;
284 
285  /* array of check flags, reported to consistentFn */
287  bool (*boolConsistentFn) (GinScanKey key);
288  GinTernaryValue (*triConsistentFn) (GinScanKey key);
292 
293  /* other data needed for calling consistentFn */
295  /* NB: these three arrays have only nuserentries elements! */
302 
303  /*
304  * Match status data. curItem is the TID most recently tested (could be a
305  * lossy-page pointer). curItemMatches is true if it passes the
306  * consistentFn test; if so, recheckCurItem is the recheck flag.
307  * isFinished means that all the input entry streams are finished, so this
308  * key cannot succeed for any later TIDs.
309  */
315 
316 typedef struct GinScanEntryData
317 {
318  /* query key and other information from extractQueryFn */
326 
327  /* Current page in posting tree */
329 
330  /* current ItemPointer to heap */
332 
333  /* for a partial-match or full-scan query, we accumulate all TIDs here */
337 
338  /* used for Posting list and one page in Posting tree */
340  int nlist;
342 
348 
349 typedef struct GinScanOpaqueData
350 {
353 
354  GinScanKey keys; /* one per scan qualifier expr */
356 
357  GinScanEntry *entries; /* one per index search condition */
359  uint32 allocentries; /* allocated length of entries[] */
360 
361  MemoryContext keyCtx; /* used to hold key and entry data */
362 
363  bool isVoidRes; /* true if query is unsatisfiable */
365 
367 
368 extern IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys);
369 extern void ginendscan(IndexScanDesc scan);
370 extern void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys,
371  ScanKey orderbys, int norderbys);
372 extern void ginNewScanKey(IndexScanDesc scan);
373 extern void ginFreeScanKeys(GinScanOpaque so);
374 
375 /* ginget.c */
376 extern int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
377 
378 /* ginlogic.c */
379 extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key);
380 
381 /* ginvacuum.c */
383  IndexBulkDeleteResult *stats,
385  void *callback_state);
387  IndexBulkDeleteResult *stats);
389  ItemPointerData *items, int nitem, int *nremaining);
390 
391 /* ginvalidate.c */
392 extern bool ginvalidate(Oid opclassoid);
393 
394 /* ginbulk.c */
395 typedef struct GinEntryAccumulator
396 {
403  uint32 maxcount; /* allocated size of list[] */
404  uint32 count; /* current number of list[] entries */
406 
407 typedef struct
408 {
416 
417 extern void ginInitBA(BuildAccumulator *accum);
418 extern void ginInsertBAEntries(BuildAccumulator *accum,
420  Datum *entries, GinNullCategory *categories,
421  int32 nentries);
422 extern void ginBeginBAScan(BuildAccumulator *accum);
424  OffsetNumber *attnum, Datum *key, GinNullCategory *category,
425  uint32 *n);
426 
427 /* ginfast.c */
428 
429 typedef struct GinTupleCollector
430 {
436 
437 extern void ginHeapTupleFastInsert(GinState *ginstate,
438  GinTupleCollector *collector);
439 extern void ginHeapTupleFastCollect(GinState *ginstate,
440  GinTupleCollector *collector,
441  OffsetNumber attnum, Datum value, bool isNull,
442  ItemPointer ht_ctid);
443 extern void ginInsertCleanup(GinState *ginstate, bool full_clean,
444  bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats);
445 
446 /* ginpostinglist.c */
447 
448 extern GinPostingList *ginCompressPostingList(const ItemPointer ptrs, int nptrs,
449  int maxsize, int *nwritten);
451 
452 extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded);
453 extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded);
455  ItemPointerData *b, uint32 nb,
456  int *nmerged);
457 
458 /*
459  * Merging the results of several gin scans compares item pointers a lot,
460  * so we want this to be inlined.
461  */
462 static inline int
464 {
465  uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a);
466  uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b);
467 
468  if (ia == ib)
469  return 0;
470  else if (ia > ib)
471  return 1;
472  else
473  return -1;
474 }
475 
476 extern int ginTraverseLock(Buffer buffer, bool searchMode);
477 
478 #endif /* GIN_PRIVATE_H */
void ginInsertValue(GinBtree btree, GinBtreeStack *stack, void *insertdata, GinStatsData *buildStats)
Definition: ginbtree.c:777
GinPostingList * ginCompressPostingList(const ItemPointer ptrs, int nptrs, int maxsize, int *nwritten)
FmgrInfo * triConsistentFmgrInfo
Definition: gin_private.h:290
GinEntryAccumulator * entryallocator
Definition: gin_private.h:411
int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
Definition: ginutil.c:217
Datum * queryValues
Definition: gin_private.h:296
void ginInsertCleanup(GinState *ginstate, bool full_clean, bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats)
Definition: ginfast.c:754
GinBtreeData btree
Definition: gin_private.h:346
Definition: fmgr.h:56
ItemPointerData curItem
Definition: gin_private.h:331
void freeGinBtreeStack(GinBtreeStack *stack)
Definition: ginbtree.c:194
OffsetNumber offset
Definition: gin_private.h:341
GinState * ginstate
Definition: gin_private.h:164
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:415
Pointer * extra_data
Definition: gin_private.h:298
uint32 predictNumberResult
Definition: gin_private.h:345
Relation index
Definition: gin_private.h:53
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:137
struct GinBtreeData GinBtreeData
OffsetNumber off
Definition: gin_private.h:128
struct GinScanEntryData GinScanEntryData
void GinInitPage(Page page, uint32 f, Size pageSize)
Definition: ginutil.c:342
int ginTraverseLock(Buffer buffer, bool searchMode)
Definition: ginbtree.c:36
TBMIterator * matchIterator
Definition: gin_private.h:335
void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate)
Definition: ginentrypage.c:745
void ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno)
Definition: gindatapage.c:1868
struct GinScanOpaqueData GinScanOpaqueData
OffsetNumber attnum
Definition: gin_private.h:400
void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset)
Definition: gindatapage.c:377
void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gindatapage.c:1894
uint16 StrategyNumber
Definition: stratnum.h:22
Pointer extra_data
Definition: gin_private.h:322
bool useFastUpdate
Definition: gin_private.h:27
void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys, ScanKey orderbys, int norderbys)
Definition: ginscan.c:413
Buffer GinNewBuffer(Relation index)
Definition: ginutil.c:291
BlockNumber rootBlkno
Definition: gin_private.h:163
uint32 BlockNumber
Definition: block.h:31
void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
Definition: ginfast.c:222
FmgrInfo * consistentFmgrInfo
Definition: gin_private.h:289
GinNullCategory category
Definition: gin_private.h:399
void ginEntryInsert(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gininsert.c:179
unsigned int Oid
Definition: postgres_ext.h:31
ItemPointerData * list
Definition: gin_private.h:339
char bool
Definition: c.h:275
signed int int32
Definition: c.h:313
uint16 OffsetNumber
Definition: off.h:24
Definition: type.h:89
IndexUniqueCheck
Definition: genam.h:111
void ginbuildempty(Relation index)
Definition: gininsert.c:437
GinScanEntry * scanEntry
Definition: gin_private.h:270
OffsetNumber entryAttnum
Definition: gin_private.h:169
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
Definition: ginlogic.c:225
char * Pointer
Definition: c.h:302
GinPlaceToPageRC
Definition: gin_private.h:138
signed char GinNullCategory
Definition: ginblock.h:200
GinBtreeStack * ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot)
Definition: gindatapage.c:1923
Definition: rbtree.h:23
struct GinScanKeyData * GinScanKey
Definition: gin_private.h:258
Datum entryKey
Definition: gin_private.h:170
char GinTernaryValue
Definition: gin.h:57
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
GinNullCategory entryCategory
Definition: gin_private.h:171
OffsetNumber attnum
Definition: gin_private.h:325
IndexBuildResult * ginbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
Definition: gininsert.c:315
struct GinBtreeStack GinBtreeStack
StrategyNumber strategy
Definition: gin_private.h:299
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: ginentrypage.c:721
GinScanOpaqueData * GinScanOpaque
Definition: gin_private.h:366
bytea * ginoptions(Datum reloptions, bool validate)
Definition: ginutil.c:607
static char * buf
Definition: pg_test_fsync.c:67
void initGinState(GinState *state, Relation index)
Definition: ginutil.c:88
void ginInsertBAEntries(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, GinNullCategory *categories, int32 nentries)
Definition: ginbulk.c:210
MemoryContext keyCtx
Definition: gin_private.h:361
GinTernaryValue * entryRes
Definition: gin_private.h:286
void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid)
Definition: ginfast.c:470
struct GinBtreeData * GinBtree
Definition: gin_private.h:135
unsigned int uint32
Definition: c.h:325
static uint64 totalsize
GinState * ginstate
Definition: gin_private.h:409
OffsetNumber attnum
Definition: gin_private.h:301
Buffer ginStepRight(Buffer buffer, Relation index, int lockmode)
Definition: ginbtree.c:166
struct GinEntryAccumulator GinEntryAccumulator
void ginendscan(IndexScanDesc scan)
Definition: ginscan.c:429
ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast)
Definition: gindatapage.c:135
bool gininsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, struct IndexInfo *indexInfo)
Definition: gininsert.c:488
struct GinScanEntryData * GinScanEntry
Definition: gin_private.h:260
uint32 nuserentries
Definition: gin_private.h:267
ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, ItemPointerData *items, int nitem, int *nremaining)
Definition: ginvacuum.c:48
void GinPageDeletePostingItem(Page page, OffsetNumber offset)
Definition: gindatapage.c:414
TIDBitmap * matchBitmap
Definition: gin_private.h:334
void ginFreeScanKeys(GinScanOpaque so)
Definition: ginscan.c:232
GinScanKey keys
Definition: gin_private.h:354
IndexTuple * tuples
Definition: gin_private.h:431
MemoryContext tempCtx
Definition: gin_private.h:351
GinScanEntry * requiredEntries
Definition: gin_private.h:280
struct GinScanKeyData GinScanKeyData
ItemPointerData * items
Definition: gin_private.h:190
uintptr_t Datum
Definition: postgres.h:365
struct GinBtreeStack * parent
Definition: gin_private.h:132
StrategyNumber strategy
Definition: gin_private.h:323
int32 vl_len_
Definition: gin_private.h:26
Relation index
Definition: gin_private.h:162
static struct @131 value
GinNullCategory * queryCategories
Definition: gin_private.h:297
GinBtreeStack * ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot)
Definition: ginbtree.c:77
TBMIterateResult * matchResult
Definition: gin_private.h:336
int16 attnum
Definition: pg_attribute.h:79
void ginVacuumPostingTreeLeaf(Relation rel, Buffer buf, GinVacuumState *gvs)
Definition: gindatapage.c:732
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
Definition: ginutil.c:250
IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys)
Definition: ginscan.c:25
void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: gindatapage.c:1340
Definition: regguts.h:298
bool ginvalidate(Oid opclassoid)
Definition: ginvalidate.c:34
ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded)
GinNullCategory queryCategory
Definition: gin_private.h:320
void GinInitBuffer(Buffer b, uint32 f)
Definition: ginutil.c:355
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:215
IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, Pointer data, Size dataSize, int nipd, bool errorTooBig)
Definition: ginentrypage.c:45
IndexBulkDeleteResult * ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
Definition: ginvacuum.c:675
#define INDEX_MAX_KEYS
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:393
size_t Size
Definition: c.h:433
int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
Definition: ginget.c:1857
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
Definition: ginutil.c:488
BlockNumber blkno
Definition: gin_private.h:126
ItemPointerData curItem
Definition: gin_private.h:310
ItemPointerData iptr
Definition: gin_private.h:129
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
Definition: gin_private.h:463
uint32 predictNumber
Definition: gin_private.h:131
static Datum values[MAXATTR]
Definition: bootstrap.c:164
ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, IndexTuple itup, int *nitems)
Definition: ginentrypage.c:163
void GinInitMetabuffer(Buffer b)
Definition: ginutil.c:361
struct GinTupleCollector GinTupleCollector
GinScanEntry * entries
Definition: gin_private.h:357
void ginBeginBAScan(BuildAccumulator *accum)
Definition: ginbulk.c:257
struct GinState GinState
ItemPointerData itemptr
Definition: gin_private.h:174
int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
Definition: gindatapage.c:182
GinScanEntry * additionalEntries
Definition: gin_private.h:282
Definition: rbtree.c:41
ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb, int *nmerged)
ItemPointerData * ginGetBAEntry(BuildAccumulator *accum, OffsetNumber *attnum, Datum *key, GinNullCategory *category, uint32 *n)
Definition: ginbulk.c:268
Definition: c.h:516
TupleDesc origTupdesc
Definition: gin_private.h:67
IndexBulkDeleteResult * ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
Definition: ginvacuum.c:552
RBTreeIterator tree_walk
Definition: gin_private.h:414
BlockNumber createPostingTree(Relation index, ItemPointerData *items, uint32 nitems, GinStatsData *buildStats, Buffer entrybuffer)
Definition: gindatapage.c:1762
ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded)
void GinCheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: ginutil.c:723
void ginInitBA(BuildAccumulator *accum)
Definition: ginbulk.c:109
bool oneCol
Definition: gin_private.h:54
#define GinItemPointerGetBlockNumber(pointer)
Definition: ginblock.h:134
int Buffer
Definition: buf.h:23
int pendingListCleanupSize
Definition: gin_private.h:28
Pointer Page
Definition: bufpage.h:74
ItemPointerData * list
Definition: gin_private.h:402
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
Definition: genam.h:83
void ginNewScanKey(IndexScanDesc scan)
Definition: ginscan.c:262
struct GinOptions GinOptions