PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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  */
78  FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */
79  /* canPartialMatch[i] is true if comparePartialFn[i] is valid */
81  /* Collations to pass to the support functions */
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);
99 extern Datum *ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
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 
107 /* gininsert.c */
109  struct IndexInfo *indexInfo);
110 extern void ginbuildempty(Relation index);
111 extern bool gininsert(Relation index, Datum *values, bool *isnull,
112  ItemPointer ht_ctid, Relation heapRel,
113  IndexUniqueCheck checkUnique,
114  struct IndexInfo *indexInfo);
115 extern void ginEntryInsert(GinState *ginstate,
116  OffsetNumber attnum, Datum key, GinNullCategory category,
117  ItemPointerData *items, uint32 nitem,
118  GinStatsData *buildStats);
119 
120 /* ginbtree.c */
121 
122 typedef struct GinBtreeStack
123 {
128  /* predictNumber contains predicted number of pages on current level */
131 } GinBtreeStack;
132 
133 typedef struct GinBtreeData *GinBtree;
134 
135 /* Return codes for GinBtreeData.beginPlaceToPage method */
136 typedef enum
137 {
142 
143 typedef struct GinBtreeData
144 {
145  /* search methods */
150 
151  /* insert methods */
153  GinPlaceToPageRC (*beginPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *);
154  void (*execPlaceToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *);
155  void *(*prepareDownlink) (GinBtree, Buffer);
157 
158  bool isData;
159 
161  BlockNumber rootBlkno;
162  GinState *ginstate; /* not valid in a data scan */
163  bool fullScan;
164  bool isBuild;
165 
166  /* Search key for Entry tree */
170 
171  /* Search key for data tree (posting tree) */
173 } GinBtreeData;
174 
175 /* This represents a tuple to be inserted to entry tree. */
176 typedef struct
177 {
178  IndexTuple entry; /* tuple to insert */
179  bool isDelete; /* delete old tuple at same offset? */
181 
182 /*
183  * This represents an itempointer, or many itempointers, to be inserted to
184  * a data (posting tree) leaf page
185  */
186 typedef struct
187 {
192 
193 /*
194  * For internal data (posting tree) pages, the insertion payload is a
195  * PostingItem
196  */
197 
198 extern GinBtreeStack *ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot);
199 extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode);
200 extern void freeGinBtreeStack(GinBtreeStack *stack);
201 extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack,
202  void *insertdata, GinStatsData *buildStats);
203 
204 /* ginentrypage.c */
205 extern IndexTuple GinFormTuple(GinState *ginstate,
206  OffsetNumber attnum, Datum key, GinNullCategory category,
207  Pointer data, Size dataSize, int nipd, bool errorTooBig);
208 extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
209  Datum key, GinNullCategory category,
210  GinState *ginstate);
211 extern void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
212 extern ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum,
213  IndexTuple itup, int *nitems);
214 
215 /* gindatapage.c */
216 extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast);
217 extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm);
219  ItemPointerData *items, uint32 nitems,
220  GinStatsData *buildStats);
221 extern void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset);
222 extern void GinPageDeletePostingItem(Page page, OffsetNumber offset);
223 extern void ginInsertItemPointers(Relation index, BlockNumber rootBlkno,
224  ItemPointerData *items, uint32 nitem,
225  GinStatsData *buildStats);
226 extern GinBtreeStack *ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot);
227 extern void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage);
228 extern void ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno);
229 
230 /*
231  * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers
232  * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward
233  * declaration for it.
234  */
236 
238 
239 /* ginscan.c */
240 
241 /*
242  * GinScanKeyData describes a single GIN index qualifier expression.
243  *
244  * From each qual expression, we extract one or more specific index search
245  * conditions, which are represented by GinScanEntryData. It's quite
246  * possible for identical search conditions to be requested by more than
247  * one qual expression, in which case we merge such conditions to have just
248  * one unique GinScanEntry --- this is particularly important for efficiency
249  * when dealing with full-index-scan entries. So there can be multiple
250  * GinScanKeyData.scanEntry pointers to the same GinScanEntryData.
251  *
252  * In each GinScanKeyData, nentries is the true number of entries, while
253  * nuserentries is the number that extractQueryFn returned (which is what
254  * we report to consistentFn). The "user" entries must come first.
255  */
256 typedef struct GinScanKeyData *GinScanKey;
257 
259 
260 typedef struct GinScanKeyData
261 {
262  /* Real number of entries in scanEntry[] (always > 0) */
264  /* Number of entries that extractQueryFn and consistentFn know about */
266 
267  /* array of GinScanEntry pointers, one per extracted search condition */
268  GinScanEntry *scanEntry;
269 
270  /*
271  * At least one of the entries in requiredEntries must be present for a
272  * tuple to match the overall qual.
273  *
274  * additionalEntries contains entries that are needed by the consistent
275  * function to decide if an item matches, but are not sufficient to
276  * satisfy the qual without entries from requiredEntries.
277  */
278  GinScanEntry *requiredEntries;
280  GinScanEntry *additionalEntries;
282 
283  /* array of check flags, reported to consistentFn */
285  bool (*boolConsistentFn) (GinScanKey key);
286  GinTernaryValue (*triConsistentFn) (GinScanKey key);
290 
291  /* other data needed for calling consistentFn */
293  /* NB: these three arrays have only nuserentries elements! */
300 
301  /*
302  * Match status data. curItem is the TID most recently tested (could be a
303  * lossy-page pointer). curItemMatches is TRUE if it passes the
304  * consistentFn test; if so, recheckCurItem is the recheck flag.
305  * isFinished means that all the input entry streams are finished, so this
306  * key cannot succeed for any later TIDs.
307  */
313 
314 typedef struct GinScanEntryData
315 {
316  /* query key and other information from extractQueryFn */
324 
325  /* Current page in posting tree */
327 
328  /* current ItemPointer to heap */
330 
331  /* for a partial-match or full-scan query, we accumulate all TIDs here */
335 
336  /* used for Posting list and one page in Posting tree */
338  int nlist;
340 
346 
347 typedef struct GinScanOpaqueData
348 {
351 
352  GinScanKey keys; /* one per scan qualifier expr */
354 
355  GinScanEntry *entries; /* one per index search condition */
357  uint32 allocentries; /* allocated length of entries[] */
358 
359  MemoryContext keyCtx; /* used to hold key and entry data */
360 
361  bool isVoidRes; /* true if query is unsatisfiable */
363 
365 
366 extern IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys);
367 extern void ginendscan(IndexScanDesc scan);
368 extern void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys,
369  ScanKey orderbys, int norderbys);
370 extern void ginNewScanKey(IndexScanDesc scan);
371 extern void ginFreeScanKeys(GinScanOpaque so);
372 
373 /* ginget.c */
374 extern int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
375 
376 /* ginlogic.c */
377 extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key);
378 
379 /* ginvacuum.c */
381  IndexBulkDeleteResult *stats,
383  void *callback_state);
385  IndexBulkDeleteResult *stats);
387  ItemPointerData *items, int nitem, int *nremaining);
388 
389 /* ginvalidate.c */
390 extern bool ginvalidate(Oid opclassoid);
391 
392 /* ginbulk.c */
393 typedef struct GinEntryAccumulator
394 {
401  uint32 maxcount; /* allocated size of list[] */
402  uint32 count; /* current number of list[] entries */
404 
405 typedef struct
406 {
414 
415 extern void ginInitBA(BuildAccumulator *accum);
416 extern void ginInsertBAEntries(BuildAccumulator *accum,
417  ItemPointer heapptr, OffsetNumber attnum,
418  Datum *entries, GinNullCategory *categories,
419  int32 nentries);
420 extern void ginBeginBAScan(BuildAccumulator *accum);
422  OffsetNumber *attnum, Datum *key, GinNullCategory *category,
423  uint32 *n);
424 
425 /* ginfast.c */
426 
427 typedef struct GinTupleCollector
428 {
434 
435 extern void ginHeapTupleFastInsert(GinState *ginstate,
436  GinTupleCollector *collector);
437 extern void ginHeapTupleFastCollect(GinState *ginstate,
438  GinTupleCollector *collector,
439  OffsetNumber attnum, Datum value, bool isNull,
440  ItemPointer ht_ctid);
441 extern void ginInsertCleanup(GinState *ginstate, bool full_clean,
442  bool fill_fsm, IndexBulkDeleteResult *stats);
443 
444 /* ginpostinglist.c */
445 
446 extern GinPostingList *ginCompressPostingList(const ItemPointer ptrs, int nptrs,
447  int maxsize, int *nwritten);
449 
450 extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded);
451 extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded);
453  ItemPointerData *b, uint32 nb,
454  int *nmerged);
455 
456 /*
457  * Merging the results of several gin scans compares item pointers a lot,
458  * so we want this to be inlined.
459  */
460 static inline int
462 {
463  uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a);
464  uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b);
465 
466  if (ia == ib)
467  return 0;
468  else if (ia > ib)
469  return 1;
470  else
471  return -1;
472 }
473 
474 extern int ginTraverseLock(Buffer buffer, bool searchMode);
475 
476 #endif /* GIN_PRIVATE_H */
void ginInsertValue(GinBtree btree, GinBtreeStack *stack, void *insertdata, GinStatsData *buildStats)
Definition: ginbtree.c:755
GinPostingList * ginCompressPostingList(const ItemPointer ptrs, int nptrs, int maxsize, int *nwritten)
FmgrInfo * triConsistentFmgrInfo
Definition: gin_private.h:288
GinEntryAccumulator * entryallocator
Definition: gin_private.h:409
int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm)
OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
Definition: ginutil.c:215
Datum * queryValues
Definition: gin_private.h:294
GinBtreeData btree
Definition: gin_private.h:344
Definition: fmgr.h:56
Oid supportCollation[INDEX_MAX_KEYS]
Definition: gin_private.h:82
ItemPointerData curItem
Definition: gin_private.h:329
void freeGinBtreeStack(GinBtreeStack *stack)
Definition: ginbtree.c:193
OffsetNumber offset
Definition: gin_private.h:339
GinState * ginstate
Definition: gin_private.h:162
int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:405
Pointer * extra_data
Definition: gin_private.h:296
uint32 predictNumberResult
Definition: gin_private.h:343
Relation index
Definition: gin_private.h:53
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:137
struct GinBtreeData GinBtreeData
OffsetNumber off
Definition: gin_private.h:126
struct GinScanEntryData GinScanEntryData
void GinInitPage(Page page, uint32 f, Size pageSize)
Definition: ginutil.c:340
int ginTraverseLock(Buffer buffer, bool searchMode)
Definition: ginbtree.c:35
TBMIterator * matchIterator
Definition: gin_private.h:333
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:1861
void ginInsertCleanup(GinState *ginstate, bool full_clean, bool fill_fsm, IndexBulkDeleteResult *stats)
Definition: ginfast.c:729
struct GinScanOpaqueData GinScanOpaqueData
OffsetNumber attnum
Definition: gin_private.h:398
void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset)
Definition: gindatapage.c:376
bool canPartialMatch[INDEX_MAX_KEYS]
Definition: gin_private.h:80
void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gindatapage.c:1887
uint16 StrategyNumber
Definition: stratnum.h:22
Pointer extra_data
Definition: gin_private.h:320
bool useFastUpdate
Definition: gin_private.h:27
FmgrInfo consistentFn[INDEX_MAX_KEYS]
Definition: gin_private.h:76
void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys, ScanKey orderbys, int norderbys)
Definition: ginscan.c:416
Buffer GinNewBuffer(Relation index)
Definition: ginutil.c:289
FmgrInfo extractValueFn[INDEX_MAX_KEYS]
Definition: gin_private.h:74
BlockNumber rootBlkno
Definition: gin_private.h:161
uint32 BlockNumber
Definition: block.h:31
void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
Definition: ginfast.c:222
FmgrInfo * consistentFmgrInfo
Definition: gin_private.h:287
GinNullCategory category
Definition: gin_private.h:397
void ginEntryInsert(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats)
Definition: gininsert.c:177
OffsetNumber(* findChildPtr)(GinBtree, Page, BlockNumber, OffsetNumber)
Definition: gin_private.h:152
unsigned int Oid
Definition: postgres_ext.h:31
ItemPointerData * list
Definition: gin_private.h:337
char bool
Definition: c.h:202
signed int int32
Definition: c.h:246
uint16 OffsetNumber
Definition: off.h:24
Definition: type.h:89
IndexUniqueCheck
Definition: genam.h:111
void ginbuildempty(Relation index)
Definition: gininsert.c:433
GinScanEntry * scanEntry
Definition: gin_private.h:268
OffsetNumber entryAttnum
Definition: gin_private.h:167
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
Definition: ginlogic.c:225
bool(* findItem)(GinBtree, GinBtreeStack *)
Definition: gin_private.h:149
char * Pointer
Definition: c.h:235
GinPlaceToPageRC
Definition: gin_private.h:136
BlockNumber(* getLeftMostChild)(GinBtree, Page)
Definition: gin_private.h:147
signed char GinNullCategory
Definition: ginblock.h:197
GinBtreeStack * ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot)
Definition: gindatapage.c:1915
Definition: rbtree.h:23
struct GinScanKeyData * GinScanKey
Definition: gin_private.h:256
Datum entryKey
Definition: gin_private.h:168
char GinTernaryValue
Definition: gin.h:57
static struct @121 value
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
GinNullCategory entryCategory
Definition: gin_private.h:169
OffsetNumber attnum
Definition: gin_private.h:323
IndexBuildResult * ginbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
Definition: gininsert.c:311
struct GinBtreeStack GinBtreeStack
StrategyNumber strategy
Definition: gin_private.h:297
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: ginentrypage.c:721
GinScanOpaqueData * GinScanOpaque
Definition: gin_private.h:364
bytea * ginoptions(Datum reloptions, bool validate)
Definition: ginutil.c:599
static char * buf
Definition: pg_test_fsync.c:67
FmgrInfo comparePartialFn[INDEX_MAX_KEYS]
Definition: gin_private.h:78
void initGinState(GinState *state, Relation index)
Definition: ginutil.c:86
void ginInsertBAEntries(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, GinNullCategory *categories, int32 nentries)
Definition: ginbulk.c:210
MemoryContext keyCtx
Definition: gin_private.h:359
GinTernaryValue * entryRes
Definition: gin_private.h:284
void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid)
Definition: ginfast.c:456
BlockNumber(* findChildPage)(GinBtree, GinBtreeStack *)
Definition: gin_private.h:146
struct GinBtreeData * GinBtree
Definition: gin_private.h:133
unsigned int uint32
Definition: c.h:258
FmgrInfo extractQueryFn[INDEX_MAX_KEYS]
Definition: gin_private.h:75
static uint64 totalsize
GinState * ginstate
Definition: gin_private.h:407
OffsetNumber attnum
Definition: gin_private.h:299
Buffer ginStepRight(Buffer buffer, Relation index, int lockmode)
Definition: ginbtree.c:165
struct GinEntryAccumulator GinEntryAccumulator
void ginendscan(IndexScanDesc scan)
Definition: ginscan.c:432
ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast)
Definition: gindatapage.c:134
bool gininsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, struct IndexInfo *indexInfo)
Definition: gininsert.c:484
struct GinScanEntryData * GinScanEntry
Definition: gin_private.h:258
uint32 nuserentries
Definition: gin_private.h:265
ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, ItemPointerData *items, int nitem, int *nremaining)
Definition: ginvacuum.c:47
void GinPageDeletePostingItem(Page page, OffsetNumber offset)
Definition: gindatapage.c:413
TIDBitmap * matchBitmap
Definition: gin_private.h:332
void ginFreeScanKeys(GinScanOpaque so)
Definition: ginscan.c:232
GinScanKey keys
Definition: gin_private.h:352
IndexTuple * tuples
Definition: gin_private.h:429
MemoryContext tempCtx
Definition: gin_private.h:349
GinScanEntry * requiredEntries
Definition: gin_private.h:278
struct GinScanKeyData GinScanKeyData
ItemPointerData * items
Definition: gin_private.h:188
uintptr_t Datum
Definition: postgres.h:372
TupleDesc tupdesc[INDEX_MAX_KEYS]
Definition: gin_private.h:68
struct GinBtreeStack * parent
Definition: gin_private.h:130
StrategyNumber strategy
Definition: gin_private.h:321
int32 vl_len_
Definition: gin_private.h:26
BlockNumber createPostingTree(Relation index, ItemPointerData *items, uint32 nitems, GinStatsData *buildStats)
Definition: gindatapage.c:1761
Relation index
Definition: gin_private.h:160
GinNullCategory * queryCategories
Definition: gin_private.h:295
GinBtreeStack * ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot)
Definition: ginbtree.c:76
TBMIterateResult * matchResult
Definition: gin_private.h:334
void ginVacuumPostingTreeLeaf(Relation rel, Buffer buf, GinVacuumState *gvs)
Definition: gindatapage.c:731
Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category)
Definition: ginutil.c:248
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:1339
Definition: regguts.h:298
bool ginvalidate(Oid opclassoid)
Definition: ginvalidate.c:34
ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded)
GinNullCategory queryCategory
Definition: gin_private.h:318
void GinInitBuffer(Buffer b, uint32 f)
Definition: ginutil.c:353
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
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:667
#define INDEX_MAX_KEYS
int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb)
Definition: ginutil.c:383
size_t Size
Definition: c.h:350
int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
Definition: ginget.c:1795
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
Definition: ginutil.c:478
BlockNumber blkno
Definition: gin_private.h:124
ItemPointerData curItem
Definition: gin_private.h:308
ItemPointerData iptr
Definition: gin_private.h:127
bool(* boolConsistentFn)(GinScanKey key)
Definition: gin_private.h:285
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
Definition: gin_private.h:461
uint32 predictNumber
Definition: gin_private.h:129
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:359
struct GinTupleCollector GinTupleCollector
GinScanEntry * entries
Definition: gin_private.h:355
void ginBeginBAScan(BuildAccumulator *accum)
Definition: ginbulk.c:257
struct GinState GinState
GinTernaryValue(* triConsistentFn)(GinScanKey key)
Definition: gin_private.h:286
ItemPointerData itemptr
Definition: gin_private.h:172
int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
Definition: gindatapage.c:181
GinScanEntry * additionalEntries
Definition: gin_private.h:280
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:433
TupleDesc origTupdesc
Definition: gin_private.h:67
IndexBulkDeleteResult * ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
Definition: ginvacuum.c:544
RBTreeIterator tree_walk
Definition: gin_private.h:412
FmgrInfo triConsistentFn[INDEX_MAX_KEYS]
Definition: gin_private.h:77
ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded)
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
void(* fillRoot)(GinBtree, Page, BlockNumber, Page, BlockNumber, Page)
Definition: gin_private.h:156
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
Definition: genam.h:83
int pendingListCleanupSize
Definition: gin_private.h:28
void(* execPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void *)
Definition: gin_private.h:154
Pointer Page
Definition: bufpage.h:74
ItemPointerData * list
Definition: gin_private.h:400
bool(* isMoveRight)(GinBtree, Page)
Definition: gin_private.h:148
void ginNewScanKey(IndexScanDesc scan)
Definition: ginscan.c:262
GinPlaceToPageRC(* beginPlaceToPage)(GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, void **, Page *, Page *)
Definition: gin_private.h:153
FmgrInfo compareFn[INDEX_MAX_KEYS]
Definition: gin_private.h:73
struct GinOptions GinOptions