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 
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 */
146  BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *);
147  BlockNumber (*getLeftMostChild) (GinBtree, Page);
148  bool (*isMoveRight) (GinBtree, Page);
149  bool (*findItem) (GinBtree, GinBtreeStack *);
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);
156  void (*fillRoot) (GinBtree, Page, BlockNumber, Page, BlockNumber, Page);
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);
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, Buffer entrybuffer);
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 
229 /*
230  * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers
231  * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward
232  * declaration for it.
233  */
235 
237 
238 /* ginscan.c */
239 
240 /*
241  * GinScanKeyData describes a single GIN index qualifier expression.
242  *
243  * From each qual expression, we extract one or more specific index search
244  * conditions, which are represented by GinScanEntryData. It's quite
245  * possible for identical search conditions to be requested by more than
246  * one qual expression, in which case we merge such conditions to have just
247  * one unique GinScanEntry --- this is particularly important for efficiency
248  * when dealing with full-index-scan entries. So there can be multiple
249  * GinScanKeyData.scanEntry pointers to the same GinScanEntryData.
250  *
251  * In each GinScanKeyData, nentries is the true number of entries, while
252  * nuserentries is the number that extractQueryFn returned (which is what
253  * we report to consistentFn). The "user" entries must come first.
254  */
255 typedef struct GinScanKeyData *GinScanKey;
256 
258 
259 typedef struct GinScanKeyData
260 {
261  /* Real number of entries in scanEntry[] (always > 0) */
263  /* Number of entries that extractQueryFn and consistentFn know about */
265 
266  /* array of GinScanEntry pointers, one per extracted search condition */
267  GinScanEntry *scanEntry;
268 
269  /*
270  * At least one of the entries in requiredEntries must be present for a
271  * tuple to match the overall qual.
272  *
273  * additionalEntries contains entries that are needed by the consistent
274  * function to decide if an item matches, but are not sufficient to
275  * satisfy the qual without entries from requiredEntries.
276  */
277  GinScanEntry *requiredEntries;
279  GinScanEntry *additionalEntries;
281 
282  /* array of check flags, reported to consistentFn */
284  bool (*boolConsistentFn) (GinScanKey key);
285  GinTernaryValue (*triConsistentFn) (GinScanKey key);
289 
290  /* other data needed for calling consistentFn */
292  /* NB: these three arrays have only nuserentries elements! */
299 
300  /*
301  * Match status data. curItem is the TID most recently tested (could be a
302  * lossy-page pointer). curItemMatches is true if it passes the
303  * consistentFn test; if so, recheckCurItem is the recheck flag.
304  * isFinished means that all the input entry streams are finished, so this
305  * key cannot succeed for any later TIDs.
306  */
312 
313 typedef struct GinScanEntryData
314 {
315  /* query key and other information from extractQueryFn */
323 
324  /* Current page in posting tree */
326 
327  /* current ItemPointer to heap */
329 
330  /* for a partial-match or full-scan query, we accumulate all TIDs here */
334 
335  /* used for Posting list and one page in Posting tree */
337  int nlist;
339 
345 
346 typedef struct GinScanOpaqueData
347 {
350 
351  GinScanKey keys; /* one per scan qualifier expr */
353 
354  GinScanEntry *entries; /* one per index search condition */
356  uint32 allocentries; /* allocated length of entries[] */
357 
358  MemoryContext keyCtx; /* used to hold key and entry data */
359 
360  bool isVoidRes; /* true if query is unsatisfiable */
362 
364 
365 extern IndexScanDesc ginbeginscan(Relation rel, int nkeys, int norderbys);
366 extern void ginendscan(IndexScanDesc scan);
367 extern void ginrescan(IndexScanDesc scan, ScanKey key, int nscankeys,
368  ScanKey orderbys, int norderbys);
369 extern void ginNewScanKey(IndexScanDesc scan);
370 extern void ginFreeScanKeys(GinScanOpaque so);
371 
372 /* ginget.c */
373 extern int64 gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
374 
375 /* ginlogic.c */
376 extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key);
377 
378 /* ginvacuum.c */
380  IndexBulkDeleteResult *stats,
382  void *callback_state);
384  IndexBulkDeleteResult *stats);
386  ItemPointerData *items, int nitem, int *nremaining);
387 
388 /* ginvalidate.c */
389 extern bool ginvalidate(Oid opclassoid);
390 
391 /* ginbulk.c */
392 typedef struct GinEntryAccumulator
393 {
400  uint32 maxcount; /* allocated size of list[] */
401  uint32 count; /* current number of list[] entries */
403 
404 typedef struct
405 {
413 
414 extern void ginInitBA(BuildAccumulator *accum);
415 extern void ginInsertBAEntries(BuildAccumulator *accum,
417  Datum *entries, GinNullCategory *categories,
418  int32 nentries);
419 extern void ginBeginBAScan(BuildAccumulator *accum);
421  OffsetNumber *attnum, Datum *key, GinNullCategory *category,
422  uint32 *n);
423 
424 /* ginfast.c */
425 
426 typedef struct GinTupleCollector
427 {
433 
434 extern void ginHeapTupleFastInsert(GinState *ginstate,
435  GinTupleCollector *collector);
436 extern void ginHeapTupleFastCollect(GinState *ginstate,
437  GinTupleCollector *collector,
438  OffsetNumber attnum, Datum value, bool isNull,
439  ItemPointer ht_ctid);
440 extern void ginInsertCleanup(GinState *ginstate, bool full_clean,
441  bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats);
442 
443 /* ginpostinglist.c */
444 
445 extern GinPostingList *ginCompressPostingList(const ItemPointer ptrs, int nptrs,
446  int maxsize, int *nwritten);
448 
449 extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded);
450 extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded);
452  ItemPointerData *b, uint32 nb,
453  int *nmerged);
454 
455 /*
456  * Merging the results of several gin scans compares item pointers a lot,
457  * so we want this to be inlined.
458  */
459 static inline int
461 {
462  uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a);
463  uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b);
464 
465  if (ia == ib)
466  return 0;
467  else if (ia > ib)
468  return 1;
469  else
470  return -1;
471 }
472 
473 extern int ginTraverseLock(Buffer buffer, bool searchMode);
474 
475 #endif /* GIN_PRIVATE_H */
void ginInsertValue(GinBtree btree, GinBtreeStack *stack, void *insertdata, GinStatsData *buildStats)
Definition: ginbtree.c:780
GinPostingList * ginCompressPostingList(const ItemPointer ptrs, int nptrs, int maxsize, int *nwritten)
FmgrInfo * triConsistentFmgrInfo
Definition: gin_private.h:287
GinEntryAccumulator * entryallocator
Definition: gin_private.h:408
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:293
void ginInsertCleanup(GinState *ginstate, bool full_clean, bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats)
Definition: ginfast.c:762
GinBtreeData btree
Definition: gin_private.h:343
Definition: fmgr.h:56
ItemPointerData curItem
Definition: gin_private.h:328
void freeGinBtreeStack(GinBtreeStack *stack)
Definition: ginbtree.c:197
OffsetNumber offset
Definition: gin_private.h:338
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:415
Pointer * extra_data
Definition: gin_private.h:295
uint32 predictNumberResult
Definition: gin_private.h:342
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:342
int ginTraverseLock(Buffer buffer, bool searchMode)
Definition: ginbtree.c:36
TBMIterator * matchIterator
Definition: gin_private.h:332
void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate)
Definition: ginentrypage.c:745
struct GinScanOpaqueData GinScanOpaqueData
OffsetNumber attnum
Definition: gin_private.h:397
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:319
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:161
uint32 BlockNumber
Definition: block.h:31
void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
Definition: ginfast.c:223
FmgrInfo * consistentFmgrInfo
Definition: gin_private.h:286
GinNullCategory category
Definition: gin_private.h:396
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:336
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:267
OffsetNumber entryAttnum
Definition: gin_private.h:167
void ginInitConsistentFunction(GinState *ginstate, GinScanKey key)
Definition: ginlogic.c:225
char * Pointer
Definition: c.h:302
GinPlaceToPageRC
Definition: gin_private.h:136
signed char GinNullCategory
Definition: ginblock.h:200
GinBtreeStack * ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, Snapshot snapshot)
Definition: gindatapage.c:1922
Definition: rbtree.h:23
struct GinScanKeyData * GinScanKey
Definition: gin_private.h:255
Datum entryKey
Definition: gin_private.h:168
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:169
OffsetNumber attnum
Definition: gin_private.h:322
IndexBuildResult * ginbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
Definition: gininsert.c:315
struct GinBtreeStack GinBtreeStack
StrategyNumber strategy
Definition: gin_private.h:296
void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage)
Definition: ginentrypage.c:721
GinScanOpaqueData * GinScanOpaque
Definition: gin_private.h:363
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:358
GinTernaryValue * entryRes
Definition: gin_private.h:283
void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid)
Definition: ginfast.c:478
struct GinBtreeData * GinBtree
Definition: gin_private.h:133
unsigned int uint32
Definition: c.h:325
static uint64 totalsize
GinState * ginstate
Definition: gin_private.h:406
OffsetNumber attnum
Definition: gin_private.h:298
Buffer ginStepRight(Buffer buffer, Relation index, int lockmode)
Definition: ginbtree.c:169
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:257
uint32 nuserentries
Definition: gin_private.h:264
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:331
void ginFreeScanKeys(GinScanOpaque so)
Definition: ginscan.c:232
GinScanKey keys
Definition: gin_private.h:351
IndexTuple * tuples
Definition: gin_private.h:428
MemoryContext tempCtx
Definition: gin_private.h:348
GinScanEntry * requiredEntries
Definition: gin_private.h:277
struct GinScanKeyData GinScanKeyData
ItemPointerData * items
Definition: gin_private.h:188
uintptr_t Datum
Definition: postgres.h:367
struct GinBtreeStack * parent
Definition: gin_private.h:130
StrategyNumber strategy
Definition: gin_private.h:320
int32 vl_len_
Definition: gin_private.h:26
Relation index
Definition: gin_private.h:160
static struct @131 value
GinNullCategory * queryCategories
Definition: gin_private.h:294
GinBtreeStack * ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot)
Definition: ginbtree.c:77
TBMIterateResult * matchResult
Definition: gin_private.h:333
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:317
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:674
#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:1849
Datum * ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories)
Definition: ginutil.c:488
BlockNumber blkno
Definition: gin_private.h:124
ItemPointerData curItem
Definition: gin_private.h:307
ItemPointerData iptr
Definition: gin_private.h:127
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
Definition: gin_private.h:460
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:361
struct GinTupleCollector GinTupleCollector
GinScanEntry * entries
Definition: gin_private.h:354
void ginBeginBAScan(BuildAccumulator *accum)
Definition: ginbulk.c:257
struct GinState GinState
ItemPointerData itemptr
Definition: gin_private.h:172
int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
Definition: gindatapage.c:182
GinScanEntry * additionalEntries
Definition: gin_private.h:279
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:551
RBTreeIterator tree_walk
Definition: gin_private.h:411
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 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:399
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
Definition: genam.h:83
void ginNewScanKey(IndexScanDesc scan)
Definition: ginscan.c:262
struct GinOptions GinOptions