PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ginblock.h File Reference
#include "storage/block.h"
#include "storage/itemptr.h"
#include "storage/off.h"
Include dependency graph for ginblock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GinPageOpaqueData
 
struct  GinMetaPageData
 
struct  PostingItem
 
struct  GinPostingList
 

Macros

#define GIN_DATA   (1 << 0)
 
#define GIN_LEAF   (1 << 1)
 
#define GIN_DELETED   (1 << 2)
 
#define GIN_META   (1 << 3)
 
#define GIN_LIST   (1 << 4)
 
#define GIN_LIST_FULLROW   (1 << 5) /* makes sense only on GIN_LIST page */
 
#define GIN_INCOMPLETE_SPLIT
 
#define GIN_COMPRESSED   (1 << 7)
 
#define GIN_METAPAGE_BLKNO   (0)
 
#define GIN_ROOT_BLKNO   (1)
 
#define GIN_CURRENT_VERSION   2
 
#define GinPageGetMeta(p)   ((GinMetaPageData *) PageGetContents(p))
 
#define GinPageGetOpaque(page)   ( (GinPageOpaque) PageGetSpecialPointer(page) )
 
#define GinPageIsLeaf(page)   ( (GinPageGetOpaque(page)->flags & GIN_LEAF) != 0 )
 
#define GinPageSetLeaf(page)   ( GinPageGetOpaque(page)->flags |= GIN_LEAF )
 
#define GinPageSetNonLeaf(page)   ( GinPageGetOpaque(page)->flags &= ~GIN_LEAF )
 
#define GinPageIsData(page)   ( (GinPageGetOpaque(page)->flags & GIN_DATA) != 0 )
 
#define GinPageSetData(page)   ( GinPageGetOpaque(page)->flags |= GIN_DATA )
 
#define GinPageIsList(page)   ( (GinPageGetOpaque(page)->flags & GIN_LIST) != 0 )
 
#define GinPageSetList(page)   ( GinPageGetOpaque(page)->flags |= GIN_LIST )
 
#define GinPageHasFullRow(page)   ( (GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW) != 0 )
 
#define GinPageSetFullRow(page)   ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW )
 
#define GinPageIsCompressed(page)   ( (GinPageGetOpaque(page)->flags & GIN_COMPRESSED) != 0 )
 
#define GinPageSetCompressed(page)   ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED )
 
#define GinPageIsDeleted(page)   ( (GinPageGetOpaque(page)->flags & GIN_DELETED) != 0 )
 
#define GinPageSetDeleted(page)   ( GinPageGetOpaque(page)->flags |= GIN_DELETED)
 
#define GinPageSetNonDeleted(page)   ( GinPageGetOpaque(page)->flags &= ~GIN_DELETED)
 
#define GinPageIsIncompleteSplit(page)   ( (GinPageGetOpaque(page)->flags & GIN_INCOMPLETE_SPLIT) != 0 )
 
#define GinPageRightMost(page)   ( GinPageGetOpaque(page)->rightlink == InvalidBlockNumber)
 
#define GinItemPointerGetBlockNumber(pointer)   BlockIdGetBlockNumber(&(pointer)->ip_blkid)
 
#define GinItemPointerGetOffsetNumber(pointer)   ((pointer)->ip_posid)
 
#define ItemPointerSetMin(p)   ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)
 
#define ItemPointerIsMin(p)
 
#define ItemPointerSetMax(p)   ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff)
 
#define ItemPointerIsMax(p)
 
#define ItemPointerSetLossyPage(p, b)   ItemPointerSet((p), (b), (OffsetNumber)0xffff)
 
#define ItemPointerIsLossyPage(p)
 
#define PostingItemGetBlockNumber(pointer)   BlockIdGetBlockNumber(&(pointer)->child_blkno)
 
#define PostingItemSetBlockNumber(pointer, blockNumber)   BlockIdSet(&((pointer)->child_blkno), (blockNumber))
 
#define GIN_CAT_NORM_KEY   0 /* normal, non-null key value */
 
#define GIN_CAT_NULL_KEY   1 /* null key value */
 
#define GIN_CAT_EMPTY_ITEM   2 /* placeholder for zero-key item */
 
#define GIN_CAT_NULL_ITEM   3 /* placeholder for null item */
 
#define GIN_CAT_EMPTY_QUERY   (-1) /* placeholder for full-scan query */
 
#define GinCategoryOffset(itup, ginstate)
 
#define GinGetNullCategory(itup, ginstate)   (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))))
 
#define GinSetNullCategory(itup, ginstate, c)   (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))) = (c))
 
#define GinGetNPosting(itup)   GinItemPointerGetOffsetNumber(&(itup)->t_tid)
 
#define GinSetNPosting(itup, n)   ItemPointerSetOffsetNumber(&(itup)->t_tid,n)
 
#define GIN_TREE_POSTING   ((OffsetNumber)0xffff)
 
#define GinIsPostingTree(itup)   (GinGetNPosting(itup) == GIN_TREE_POSTING)
 
#define GinSetPostingTree(itup, blkno)   ( GinSetNPosting((itup),GIN_TREE_POSTING), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) )
 
#define GinGetPostingTree(itup)   GinItemPointerGetBlockNumber(&(itup)->t_tid)
 
#define GIN_ITUP_COMPRESSED   (1U << 31)
 
#define GinGetPostingOffset(itup)   (GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED))
 
#define GinSetPostingOffset(itup, n)   ItemPointerSetBlockNumber(&(itup)->t_tid,(n)|GIN_ITUP_COMPRESSED)
 
#define GinGetPosting(itup)   ((Pointer) ((char*)(itup) + GinGetPostingOffset(itup)))
 
#define GinItupIsCompressed(itup)   ((GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED) != 0)
 
#define GinMaxItemSize
 
#define GinGetDownlink(itup)   GinItemPointerGetBlockNumber(&(itup)->t_tid)
 
#define GinSetDownlink(itup, blkno)   ItemPointerSet(&(itup)->t_tid, blkno, InvalidOffsetNumber)
 
#define GinDataLeafPageGetPostingList(page)   (GinPostingList *) ((PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData))))
 
#define GinDataLeafPageGetPostingListSize(page)   (((PageHeader) page)->pd_lower - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(ItemPointerData)))
 
#define GinDataLeafPageIsEmpty(page)   (GinPageIsCompressed(page) ? (GinDataLeafPageGetPostingListSize(page) == 0) : (GinPageGetOpaque(page)->maxoff < FirstOffsetNumber))
 
#define GinDataLeafPageGetFreeSpace(page)   PageGetExactFreeSpace(page)
 
#define GinDataPageGetRightBound(page)   ((ItemPointer) PageGetContents(page))
 
#define GinDataPageGetData(page)   (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData)))
 
#define GinDataPageGetPostingItem(page, i)   ((PostingItem *) (GinDataPageGetData(page) + ((i)-1) * sizeof(PostingItem)))
 
#define GinDataPageSetDataSize(page, size)
 
#define GinNonLeafDataPageGetFreeSpace(page)
 
#define GinDataPageMaxDataSize
 
#define GinListPageSize   ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) )
 
#define SizeOfGinPostingList(plist)   (offsetof(GinPostingList, bytes) + SHORTALIGN((plist)->nbytes) )
 
#define GinNextPostingListSegment(cur)   ((GinPostingList *) (((char *) (cur)) + SizeOfGinPostingList((cur))))
 

Typedefs

typedef struct GinPageOpaqueData GinPageOpaqueData
 
typedef GinPageOpaqueDataGinPageOpaque
 
typedef struct GinMetaPageData GinMetaPageData
 
typedef signed char GinNullCategory
 

Macro Definition Documentation

#define GIN_CAT_EMPTY_ITEM   2 /* placeholder for zero-key item */

Definition at line 194 of file ginblock.h.

Referenced by ginExtractEntries(), and ginFillScanKey().

#define GIN_CAT_EMPTY_QUERY   (-1) /* placeholder for full-scan query */

Definition at line 196 of file ginblock.h.

Referenced by collectMatchesForHeapRow(), ginFillScanKey(), and startScanEntry().

#define GIN_CAT_NORM_KEY   0 /* normal, non-null key value */
#define GIN_CAT_NULL_ITEM   3 /* placeholder for null item */

Definition at line 195 of file ginblock.h.

Referenced by collectMatchBitmap(), collectMatchesForHeapRow(), and ginExtractEntries().

#define GIN_CAT_NULL_KEY   1 /* null key value */

Definition at line 193 of file ginblock.h.

#define GIN_COMPRESSED   (1 << 7)
#define GIN_CURRENT_VERSION   2

Definition at line 101 of file ginblock.h.

Referenced by GinInitMetabuffer().

#define GIN_DATA   (1 << 0)
#define GIN_INCOMPLETE_SPLIT
Value:
(1 << 6) /* page was split, but parent not
* updated */

Definition at line 45 of file ginblock.h.

Referenced by gin_page_opaque_info(), ginPlaceToPage(), and ginRedoClearIncompleteSplit().

#define GIN_ITUP_COMPRESSED   (1U << 31)

Definition at line 219 of file ginblock.h.

#define GIN_LIST   (1 << 4)

Definition at line 43 of file ginblock.h.

Referenced by gin_page_opaque_info(), ginRedoInsertListPage(), and writeListPage().

#define GIN_LIST_FULLROW   (1 << 5) /* makes sense only on GIN_LIST page */

Definition at line 44 of file ginblock.h.

Referenced by gin_page_opaque_info().

#define GIN_META   (1 << 3)
#define GIN_ROOT_BLKNO   (1)
#define GIN_TREE_POSTING   ((OffsetNumber)0xffff)

Definition at line 214 of file ginblock.h.

#define GinCategoryOffset (   itup,
  ginstate 
)
Value:
(IndexInfoFindDataOffset((itup)->t_info) + \
((ginstate)->oneCol ? 0 : sizeof(int16)))
signed short int16
Definition: c.h:255
#define IndexInfoFindDataOffset(t_info)
Definition: itup.h:80

Definition at line 201 of file ginblock.h.

Referenced by GinFormTuple().

#define GinDataLeafPageGetFreeSpace (   page)    PageGetExactFreeSpace(page)

Definition at line 270 of file ginblock.h.

Referenced by dataBeginPlaceToPageLeaf().

#define GinDataLeafPageGetPostingListSize (   page)    (((PageHeader) page)->pd_lower - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(ItemPointerData)))
#define GinDataLeafPageIsEmpty (   page)    (GinPageIsCompressed(page) ? (GinDataLeafPageGetPostingListSize(page) == 0) : (GinPageGetOpaque(page)->maxoff < FirstOffsetNumber))

Definition at line 267 of file ginblock.h.

Referenced by ginScanToDelete(), and ginVacuumPostingTreeLeaves().

#define GinDataPageGetData (   page)    (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData)))

Definition at line 279 of file ginblock.h.

Referenced by dataLeafPageGetUncompressed(), and ginRedoRecompress().

#define GinDataPageMaxDataSize
Value:
#define SizeOfPageHeaderData
Definition: bufpage.h:213
#define MAXALIGN(LEN)
Definition: c.h:588

Definition at line 303 of file ginblock.h.

Referenced by createPostingTree(), dataBeginPlaceToPageLeaf(), dataPlaceToPageLeafRecompress(), ginVacuumPostingTreeLeaf(), and leafRepackItems().

#define GinDataPageSetDataSize (   page,
  size 
)
Value:
{ \
((PageHeader) page)->pd_lower = (size) + MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(ItemPointerData)); \
}
#define SizeOfPageHeaderData
Definition: bufpage.h:213
PageHeaderData * PageHeader
Definition: bufpage.h:162
#define Assert(condition)
Definition: c.h:675
#define MAXALIGN(LEN)
Definition: c.h:588
#define GinDataPageMaxDataSize
Definition: ginblock.h:303

Definition at line 293 of file ginblock.h.

Referenced by createPostingTree(), dataPlaceToPageLeafRecompress(), dataPlaceToPageLeafSplit(), dataSplitPageInternal(), GinDataPageAddPostingItem(), GinPageDeletePostingItem(), ginRedoCreatePTree(), and ginRedoRecompress().

#define GinGetDownlink (   itup)    GinItemPointerGetBlockNumber(&(itup)->t_tid)
#define GinGetNPosting (   itup)    GinItemPointerGetOffsetNumber(&(itup)->t_tid)

Definition at line 212 of file ginblock.h.

Referenced by collectMatchBitmap(), ginReadTuple(), ginVacuumEntryPage(), and startScanEntry().

#define GinGetNullCategory (   itup,
  ginstate 
)    (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))))

Definition at line 204 of file ginblock.h.

Referenced by gintuple_get_key().

#define GinGetPosting (   itup)    ((Pointer) ((char*)(itup) + GinGetPostingOffset(itup)))

Definition at line 222 of file ginblock.h.

Referenced by GinFormTuple(), ginReadTuple(), and ginVacuumEntryPage().

#define GinGetPostingOffset (   itup)    (GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED))

Definition at line 220 of file ginblock.h.

Referenced by GinFormInteriorTuple().

#define GinGetPostingTree (   itup)    GinItemPointerGetBlockNumber(&(itup)->t_tid)

Definition at line 217 of file ginblock.h.

Referenced by collectMatchBitmap(), ginEntryInsert(), and startScanEntry().

#define GinIsPostingTree (   itup)    (GinGetNPosting(itup) == GIN_TREE_POSTING)
#define GinItemPointerGetBlockNumber (   pointer)    BlockIdGetBlockNumber(&(pointer)->ip_blkid)

Definition at line 134 of file ginblock.h.

Referenced by entryGetItem(), entryLoadMoreItems(), keyGetItem(), and scanGetItem().

#define GinItemPointerGetOffsetNumber (   pointer)    ((pointer)->ip_posid)

Definition at line 137 of file ginblock.h.

Referenced by entryGetItem(), and entryLoadMoreItems().

#define GinItupIsCompressed (   itup)    ((GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED) != 0)

Definition at line 223 of file ginblock.h.

Referenced by ginReadTuple(), and ginVacuumEntryPage().

#define GinListPageSize   ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) )

Definition at line 311 of file ginblock.h.

Referenced by ginHeapTupleFastInsert(), and makeSublist().

#define GinMaxItemSize
Value:
MAXALIGN_DOWN(((BLCKSZ - \
MAXALIGN(sizeof(GinPageOpaqueData))) / 3)))
#define Min(x, y)
Definition: c.h:806
#define INDEX_SIZE_MASK
Definition: itup.h:65
#define SizeOfPageHeaderData
Definition: bufpage.h:213
#define MAXALIGN(LEN)
Definition: c.h:588
#define MAXALIGN_DOWN(LEN)
Definition: c.h:600

Definition at line 232 of file ginblock.h.

Referenced by addItemPointersToLeafTuple(), buildFreshLeafTuple(), GinFormTuple(), and ginVacuumEntryPage().

#define GinNextPostingListSegment (   cur)    ((GinPostingList *) (((char *) (cur)) + SizeOfGinPostingList((cur))))
#define GinNonLeafDataPageGetFreeSpace (   page)
Value:
GinPageGetOpaque(page)->maxoff * sizeof(PostingItem))
#define GinPageGetOpaque(page)
Definition: ginblock.h:109
#define GinDataPageMaxDataSize
Definition: ginblock.h:303

Definition at line 299 of file ginblock.h.

Referenced by dataBeginPlaceToPageInternal(), and dataSplitPageInternal().

#define GinPageHasFullRow (   page)    ( (GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW) != 0 )

Definition at line 118 of file ginblock.h.

Referenced by collectMatchesForHeapRow(), ginInsertCleanup(), and scanGetCandidate().

#define GinPageIsDeleted (   page)    ( (GinPageGetOpaque(page)->flags & GIN_DELETED) != 0 )

Definition at line 123 of file ginblock.h.

Referenced by ginInsertCleanup(), GinNewBuffer(), ginStepRight(), ginvacuumcleanup(), and shiftList().

#define GinPageIsIncompleteSplit (   page)    ( (GinPageGetOpaque(page)->flags & GIN_INCOMPLETE_SPLIT) != 0 )

Definition at line 126 of file ginblock.h.

Referenced by ginFindLeafPage(), ginFindParents(), ginFinishSplit(), and ginInsertValue().

#define GinPageIsList (   page)    ( (GinPageGetOpaque(page)->flags & GIN_LIST) != 0 )

Definition at line 116 of file ginblock.h.

Referenced by ginvacuumcleanup().

#define GinPageSetCompressed (   page)    ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED )

Definition at line 121 of file ginblock.h.

Referenced by dataPlaceToPageLeafRecompress(), and ginRedoRecompress().

#define GinPageSetData (   page)    ( GinPageGetOpaque(page)->flags |= GIN_DATA )

Definition at line 115 of file ginblock.h.

#define GinPageSetDeleted (   page)    ( GinPageGetOpaque(page)->flags |= GIN_DELETED)

Definition at line 124 of file ginblock.h.

#define GinPageSetFullRow (   page)    ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW )

Definition at line 119 of file ginblock.h.

Referenced by ginRedoInsertListPage(), and writeListPage().

#define GinPageSetLeaf (   page)    ( GinPageGetOpaque(page)->flags |= GIN_LEAF )

Definition at line 112 of file ginblock.h.

#define GinPageSetList (   page)    ( GinPageGetOpaque(page)->flags |= GIN_LIST )

Definition at line 117 of file ginblock.h.

#define GinPageSetNonDeleted (   page)    ( GinPageGetOpaque(page)->flags &= ~GIN_DELETED)

Definition at line 125 of file ginblock.h.

#define GinPageSetNonLeaf (   page)    ( GinPageGetOpaque(page)->flags &= ~GIN_LEAF )

Definition at line 113 of file ginblock.h.

#define GinSetDownlink (   itup,
  blkno 
)    ItemPointerSet(&(itup)->t_tid, blkno, InvalidOffsetNumber)

Definition at line 242 of file ginblock.h.

Referenced by entryPreparePage(), GinFormInteriorTuple(), and ginRedoInsertEntry().

#define GinSetNPosting (   itup,
 
)    ItemPointerSetOffsetNumber(&(itup)->t_tid,n)

Definition at line 213 of file ginblock.h.

Referenced by GinFormTuple().

#define GinSetNullCategory (   itup,
  ginstate,
  c 
)    (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))) = (c))

Definition at line 206 of file ginblock.h.

Referenced by GinFormTuple().

#define GinSetPostingOffset (   itup,
 
)    ItemPointerSetBlockNumber(&(itup)->t_tid,(n)|GIN_ITUP_COMPRESSED)

Definition at line 221 of file ginblock.h.

Referenced by GinFormTuple().

#define GinSetPostingTree (   itup,
  blkno 
)    ( GinSetNPosting((itup),GIN_TREE_POSTING), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) )

Definition at line 216 of file ginblock.h.

Referenced by addItemPointersToLeafTuple(), and buildFreshLeafTuple().

#define ItemPointerIsLossyPage (   p)
Value:
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:137
uint16 OffsetNumber
Definition: off.h:24
#define InvalidBlockNumber
Definition: block.h:33
#define GinItemPointerGetBlockNumber(pointer)
Definition: ginblock.h:134

Definition at line 162 of file ginblock.h.

Referenced by entryGetItem(), entryLoadMoreItems(), gingetbitmap(), keyGetItem(), and scanGetItem().

#define ItemPointerIsMax (   p)
Value:
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:137
uint16 OffsetNumber
Definition: off.h:24
#define InvalidBlockNumber
Definition: block.h:33
#define GinItemPointerGetBlockNumber(pointer)
Definition: ginblock.h:134

Definition at line 157 of file ginblock.h.

#define ItemPointerIsMin (   p)
Value:
#define GinItemPointerGetOffsetNumber(pointer)
Definition: ginblock.h:137
uint32 BlockNumber
Definition: block.h:31
uint16 OffsetNumber
Definition: off.h:24
#define GinItemPointerGetBlockNumber(pointer)
Definition: ginblock.h:134

Definition at line 152 of file ginblock.h.

#define ItemPointerSetLossyPage (   p,
 
)    ItemPointerSet((p), (b), (OffsetNumber)0xffff)

Definition at line 160 of file ginblock.h.

Referenced by entryGetItem(), and keyGetItem().

#define ItemPointerSetMax (   p)    ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff)

Definition at line 155 of file ginblock.h.

Referenced by keyGetItem().

#define ItemPointerSetMin (   p)    ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)
#define PostingItemGetBlockNumber (   pointer)    BlockIdGetBlockNumber(&(pointer)->child_blkno)
#define PostingItemSetBlockNumber (   pointer,
  blockNumber 
)    BlockIdSet(&((pointer)->child_blkno), (blockNumber))

Typedef Documentation

typedef signed char GinNullCategory

Definition at line 190 of file ginblock.h.

Definition at line 37 of file ginblock.h.