PostgreSQL Source Code
git master
|
#include "access/amapi.h"
#include "access/gin.h"
#include "access/ginblock.h"
#include "access/itup.h"
#include "catalog/pg_am_d.h"
#include "fmgr.h"
#include "lib/rbtree.h"
#include "storage/bufmgr.h"
Go to the source code of this file.
Data Structures | |
struct | GinOptions |
struct | GinState |
struct | GinBtreeStack |
struct | GinBtreeData |
struct | GinBtreeEntryInsertData |
struct | GinBtreeDataLeafInsertData |
struct | GinScanKeyData |
struct | GinScanEntryData |
struct | GinScanOpaqueData |
struct | GinEntryAccumulator |
struct | BuildAccumulator |
struct | GinTupleCollector |
Macros | |
#define | GIN_DEFAULT_USE_FASTUPDATE true |
#define | GinGetUseFastUpdate(relation) |
#define | GinGetPendingListCleanupSize(relation) |
#define | GIN_UNLOCK BUFFER_LOCK_UNLOCK |
#define | GIN_SHARE BUFFER_LOCK_SHARE |
#define | GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE |
Typedefs | |
typedef struct GinOptions | GinOptions |
typedef struct GinState | GinState |
typedef struct GinBtreeStack | GinBtreeStack |
typedef struct GinBtreeData * | GinBtree |
typedef struct GinBtreeData | GinBtreeData |
typedef struct GinVacuumState | GinVacuumState |
typedef struct GinScanKeyData * | GinScanKey |
typedef struct GinScanEntryData * | GinScanEntry |
typedef struct GinScanKeyData | GinScanKeyData |
typedef struct GinScanEntryData | GinScanEntryData |
typedef struct GinScanOpaqueData | GinScanOpaqueData |
typedef GinScanOpaqueData * | GinScanOpaque |
typedef struct GinEntryAccumulator | GinEntryAccumulator |
typedef struct GinTupleCollector | GinTupleCollector |
Enumerations | |
enum | GinPlaceToPageRC { GPTP_NO_WORK , GPTP_INSERT , GPTP_SPLIT } |
#define GIN_DEFAULT_USE_FASTUPDATE true |
Definition at line 32 of file gin_private.h.
#define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE |
Definition at line 50 of file gin_private.h.
#define GIN_SHARE BUFFER_LOCK_SHARE |
Definition at line 49 of file gin_private.h.
#define GIN_UNLOCK BUFFER_LOCK_UNLOCK |
Definition at line 48 of file gin_private.h.
#define GinGetPendingListCleanupSize | ( | relation | ) |
Definition at line 38 of file gin_private.h.
#define GinGetUseFastUpdate | ( | relation | ) |
Definition at line 33 of file gin_private.h.
typedef struct GinBtreeData* GinBtree |
Definition at line 139 of file gin_private.h.
typedef struct GinBtreeData GinBtreeData |
typedef struct GinBtreeStack GinBtreeStack |
typedef struct GinEntryAccumulator GinEntryAccumulator |
typedef struct GinOptions GinOptions |
typedef struct GinScanEntryData* GinScanEntry |
Definition at line 265 of file gin_private.h.
typedef struct GinScanEntryData GinScanEntryData |
typedef struct GinScanKeyData* GinScanKey |
Definition at line 263 of file gin_private.h.
typedef struct GinScanKeyData GinScanKeyData |
typedef GinScanOpaqueData* GinScanOpaque |
Definition at line 385 of file gin_private.h.
typedef struct GinScanOpaqueData GinScanOpaqueData |
typedef struct GinTupleCollector GinTupleCollector |
typedef struct GinVacuumState GinVacuumState |
Definition at line 234 of file gin_private.h.
enum GinPlaceToPageRC |
BlockNumber createPostingTree | ( | Relation | index, |
ItemPointerData * | items, | ||
uint32 | nitems, | ||
GinStatsData * | buildStats, | ||
Buffer | entrybuffer | ||
) |
Definition at line 1769 of file gindatapage.c.
References BufferGetBlockNumber(), BufferGetPage(), data, DEBUG2, elog(), END_CRIT_SECTION, GIN_COMPRESSED, GIN_DATA, GIN_LEAF, ginCompressPostingList(), GinDataLeafPageGetPostingList, GinDataPageMaxDataSize, GinDataPageSetDataSize, GinInitPage(), ginInsertItemPointers(), GinNewBuffer(), GinPageGetOpaque, GinPostingListSegmentMaxSize, InvalidBlockNumber, MarkBufferDirty(), GinStatsData::nDataPages, nitems, PageRestoreTempPage(), PageSetLSN(), palloc(), pfree(), PredicateLockPageSplit(), REGBUF_WILL_INIT, RelationNeedsWAL, SizeOfGinPostingList, START_CRIT_SECTION, UnlockReleaseBuffer(), XLOG_GIN_CREATE_PTREE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by addItemPointersToLeafTuple(), and buildFreshLeafTuple().
void freeGinBtreeStack | ( | GinBtreeStack * | stack | ) |
Definition at line 192 of file ginbtree.c.
References GinBtreeStack::buffer, InvalidBuffer, GinBtreeStack::parent, pfree(), and ReleaseBuffer().
Referenced by entryLoadMoreItems(), ginEntryInsert(), ginFinishSplit(), ginInsertValue(), scanPostingTree(), and startScanEntry().
Definition at line 279 of file ginvalidate.c.
References ereport, errcode(), errmsg(), ERROR, functions, GIN_COMPARE_PARTIAL_PROC, GIN_COMPARE_PROC, GIN_CONSISTENT_PROC, GIN_EXTRACTQUERY_PROC, GIN_EXTRACTVALUE_PROC, GIN_OPTIONS_PROC, GIN_TRICONSISTENT_PROC, lfirst, OpFamilyMember::number, OpFamilyMember::ref_is_family, OpFamilyMember::ref_is_hard, and OpFamilyMember::refobjid.
Referenced by ginhandler().
void ginBeginBAScan | ( | BuildAccumulator * | accum | ) |
Definition at line 257 of file ginbulk.c.
References LeftRightWalk, rbt_begin_iterate(), BuildAccumulator::tree, and BuildAccumulator::tree_walk.
Referenced by ginbuild(), ginBuildCallback(), and ginInsertCleanup().
IndexScanDesc ginbeginscan | ( | Relation | rel, |
int | nkeys, | ||
int | norderbys | ||
) |
Definition at line 25 of file ginscan.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert(), CurrentMemoryContext, GinScanOpaqueData::ginstate, IndexScanDescData::indexRelation, initGinState(), GinScanOpaqueData::keyCtx, GinScanOpaqueData::keys, GinScanOpaqueData::nkeys, IndexScanDescData::opaque, palloc(), RelationGetIndexScan(), and GinScanOpaqueData::tempCtx.
Referenced by ginhandler().
IndexBuildResult* ginbuild | ( | Relation | heap, |
Relation | index, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 320 of file gininsert.c.
References GinBuildState::accum, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, attnum, GinBuildState::buildStats, CHECK_FOR_INTERRUPTS, CurrentMemoryContext, elog(), END_CRIT_SECTION, ERROR, GinBuildState::funcCtx, GIN_LEAF, ginBeginBAScan(), ginBuildCallback(), ginEntryInsert(), ginGetBAEntry(), ginInitBA(), GinInitBuffer(), GinInitMetabuffer(), GinNewBuffer(), GinBuildState::ginstate, BuildAccumulator::ginstate, ginUpdateStats(), IndexBuildResult::heap_tuples, IndexBuildResult::index_tuples, GinBuildState::indtuples, initGinState(), sort-test::key, sort-test::list, log_newpage_range(), MAIN_FORKNUM, MarkBufferDirty(), MemoryContextDelete(), MemoryContextSwitchTo(), GinStatsData::nEntryPages, GinStatsData::nTotalPages, palloc(), RelationGetNumberOfBlocks, RelationGetRelationName, RelationNeedsWAL, START_CRIT_SECTION, table_index_build_scan(), GinBuildState::tmpCtx, and UnlockReleaseBuffer().
Referenced by ginhandler().
void ginbuildempty | ( | Relation | index | ) |
Definition at line 437 of file gininsert.c.
References BMR_REL, EB_LOCK_FIRST, EB_SKIP_EXTENSION_LOCK, END_CRIT_SECTION, ExtendBufferedRel(), GIN_LEAF, GinInitBuffer(), GinInitMetabuffer(), INIT_FORKNUM, log_newpage_buffer(), MarkBufferDirty(), START_CRIT_SECTION, and UnlockReleaseBuffer().
Referenced by ginhandler().
IndexBulkDeleteResult* ginbulkdelete | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats, | ||
IndexBulkDeleteCallback | callback, | ||
void * | callback_state | ||
) |
Definition at line 565 of file ginvacuum.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert(), DataPageDeleteStack::blkno, BufferGetPage(), GinVacuumState::callback, callback(), GinVacuumState::callback_state, CurrentMemoryContext, END_CRIT_SECTION, FirstOffsetNumber, GIN_EXCLUSIVE, GIN_ROOT_BLKNO, GIN_SHARE, GIN_UNLOCK, GinGetDownlink, ginInsertCleanup(), GinPageGetOpaque, GinPageIsData, GinPageIsLeaf, GinVacuumState::ginstate, ginVacuumEntryPage(), ginVacuumPostingTree(), i, GinVacuumState::index, IndexVacuumInfo::index, initGinState(), InvalidBlockNumber, IsAutoVacuumWorkerProcess(), LockBuffer(), MAIN_FORKNUM, MarkBufferDirty(), MemoryContextDelete(), IndexBulkDeleteResult::num_index_tuples, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageRestoreTempPage(), palloc0(), RBM_NORMAL, ReadBufferExtended(), GinVacuumState::result, START_CRIT_SECTION, GinVacuumState::strategy, IndexVacuumInfo::strategy, GinVacuumState::tmpCxt, UnlockReleaseBuffer(), vacuum_delay_point(), and xlogVacuumPage().
Referenced by ginhandler().
int ginCompareAttEntries | ( | GinState * | ginstate, |
OffsetNumber | attnuma, | ||
Datum | a, | ||
GinNullCategory | categorya, | ||
OffsetNumber | attnumb, | ||
Datum | b, | ||
GinNullCategory | categoryb | ||
) |
Definition at line 409 of file ginutil.c.
References a, b, and ginCompareEntries().
Referenced by cmpEntryAccumulator(), entryIsMoveRight(), entryLocateEntry(), and entryLocateLeafEntry().
int ginCompareEntries | ( | GinState * | ginstate, |
OffsetNumber | attnum, | ||
Datum | a, | ||
GinNullCategory | categorya, | ||
Datum | b, | ||
GinNullCategory | categoryb | ||
) |
Definition at line 387 of file ginutil.c.
References a, attnum, b, GinState::compareFn, DatumGetInt32(), FunctionCall2Coll(), GIN_CAT_NORM_KEY, and GinState::supportCollation.
Referenced by collectMatchBitmap(), collectMatchesForHeapRow(), ginCompareAttEntries(), and ginFillScanEntry().
|
inlinestatic |
Definition at line 487 of file gin_private.h.
References a, b, GinItemPointerGetBlockNumber, and GinItemPointerGetOffsetNumber.
Referenced by addItemsToLeaf(), dataBeginPlaceToPageLeaf(), dataIsMoveRight(), dataLocateItem(), entryGetItem(), entryLoadMoreItems(), ginCombineData(), GinDataLeafPageGetItems(), ginMergeItemPointers(), ginPostingListDecodeAllSegments(), keyGetItem(), qsortCompareItemPointers(), and scanGetItem().
GinPostingList* ginCompressPostingList | ( | const ItemPointer | ipd, |
int | nipd, | ||
int | maxsize, | ||
int * | nwritten | ||
) |
Definition at line 197 of file ginpostinglist.c.
References Assert(), buf, GinPostingList::bytes, encode_varbyte(), GinPostingList::first, ginPostingListDecode(), if(), itemptr_to_uint64(), MaxBytesPerInteger, GinPostingList::nbytes, palloc(), pfree(), SHORTALIGN, SHORTALIGN_DOWN, SizeOfGinPostingList, and val.
Referenced by addItemPointersToLeafTuple(), buildFreshLeafTuple(), createPostingTree(), ginRedoRecompress(), ginVacuumEntryPage(), ginVacuumPostingTreeLeaf(), leafRepackItems(), and test_itemptr_pair().
void ginDataFillRoot | ( | GinBtree | btree, |
Page | root, | ||
BlockNumber | lblkno, | ||
Page | lpage, | ||
BlockNumber | rblkno, | ||
Page | rpage | ||
) |
Definition at line 1343 of file gindatapage.c.
References GinDataPageAddPostingItem(), GinDataPageGetRightBound, InvalidOffsetNumber, PostingItem::key, and PostingItemSetBlockNumber.
Referenced by ginPrepareDataScan().
ItemPointer GinDataLeafPageGetItems | ( | Page | page, |
int * | nitems, | ||
ItemPointerData | advancePast | ||
) |
Definition at line 135 of file gindatapage.c.
References dataLeafPageGetUncompressed(), ginCompareItemPointers(), GinDataLeafPageGetPostingList, GinDataLeafPageGetPostingListSize, GinNextPostingListSegment, GinPageIsCompressed, ginPostingListDecodeAllSegments(), ItemPointerIsValid(), len, next, nitems, and palloc().
Referenced by entryLoadMoreItems(), and startScanEntry().
Definition at line 182 of file gindatapage.c.
References dataLeafPageGetUncompressed(), GinDataLeafPageGetPostingList, GinDataLeafPageGetPostingListSize, GinPageIsCompressed, ginPostingListDecodeAllSegmentsToTbm(), len, nitems, and tbm_add_tuples().
Referenced by scanPostingTree().
void GinDataPageAddPostingItem | ( | Page | page, |
PostingItem * | data, | ||
OffsetNumber | offset | ||
) |
Definition at line 380 of file gindatapage.c.
References Assert(), data, GinDataPageGetPostingItem, GinDataPageSetDataSize, GinPageGetOpaque, GinPageIsLeaf, InvalidBlockNumber, InvalidOffsetNumber, and PostingItemGetBlockNumber.
Referenced by dataExecPlaceToPageInternal(), ginDataFillRoot(), and ginRedoInsertData().
void ginendscan | ( | IndexScanDesc | scan | ) |
Definition at line 458 of file ginscan.c.
References ginFreeScanKeys(), GinScanOpaqueData::keyCtx, MemoryContextDelete(), IndexScanDescData::opaque, pfree(), and GinScanOpaqueData::tempCtx.
Referenced by ginhandler().
void ginEntryFillRoot | ( | GinBtree | btree, |
Page | root, | ||
BlockNumber | lblkno, | ||
Page | lpage, | ||
BlockNumber | rblkno, | ||
Page | rpage | ||
) |
Definition at line 721 of file ginentrypage.c.
References elog(), ERROR, getRightMostTuple(), GinFormInteriorTuple(), IndexTupleSize, InvalidOffsetNumber, PageAddItem, and pfree().
Referenced by ginPrepareEntryScan().
void ginEntryInsert | ( | GinState * | ginstate, |
OffsetNumber | attnum, | ||
Datum | key, | ||
GinNullCategory | category, | ||
ItemPointerData * | items, | ||
uint32 | nitem, | ||
GinStatsData * | buildStats | ||
) |
Definition at line 179 of file gininsert.c.
References addItemPointersToLeafTuple(), attnum, GinBtreeStack::buffer, BufferGetBlockNumber(), BufferGetPage(), buildFreshLeafTuple(), CheckForSerializableConflictIn(), GinBtreeEntryInsertData::entry, GinBtreeData::findItem, freeGinBtreeStack(), GIN_UNLOCK, ginFindLeafPage(), GinGetPostingTree, ginInsertItemPointers(), ginInsertValue(), GinIsPostingTree, ginPrepareEntryScan(), GinState::index, GinBtreeData::isBuild, GinBtreeEntryInsertData::isDelete, sort-test::key, LockBuffer(), GinStatsData::nEntries, GinBtreeStack::off, PageGetItem(), PageGetItemId(), and pfree().
Referenced by ginbuild(), ginBuildCallback(), ginHeapTupleInsert(), and ginInsertCleanup().
Datum* ginExtractEntries | ( | GinState * | ginstate, |
OffsetNumber | attnum, | ||
Datum | value, | ||
bool | isNull, | ||
int32 * | nentries, | ||
GinNullCategory ** | categories | ||
) |
Definition at line 482 of file ginutil.c.
References arg, attnum, cmpEntries(), GinState::compareFn, keyEntryData::datum, DatumGetPointer(), GinState::extractValueFn, FunctionCall3Coll(), GIN_CAT_EMPTY_ITEM, GIN_CAT_NORM_KEY, GIN_CAT_NULL_ITEM, GIN_CAT_NULL_KEY, i, keyEntryData::isnull, j, palloc(), palloc0(), pfree(), PointerGetDatum(), qsort_arg(), GinState::supportCollation, and value.
Referenced by ginHeapTupleBulkInsert(), ginHeapTupleFastCollect(), and ginHeapTupleInsert().
GinBtreeStack* ginFindLeafPage | ( | GinBtree | btree, |
bool | searchMode, | ||
bool | rootConflictCheck | ||
) |
Definition at line 80 of file ginbtree.c.
References Assert(), GinBtreeStack::blkno, GinBtreeStack::buffer, BufferGetPage(), CheckForSerializableConflictIn(), GinBtreeData::findChildPage, GinBtreeData::fullScan, GIN_UNLOCK, ginFinishSplit(), GinPageGetOpaque, GinPageIsIncompleteSplit, GinPageIsLeaf, ginStepRight(), ginTraverseLock(), GinBtreeData::index, InvalidBlockNumber, InvalidOffsetNumber, GinBtreeData::isMoveRight, LockBuffer(), GinBtreeStack::off, palloc(), GinBtreeStack::parent, GinBtreeStack::predictNumber, ReadBuffer(), ReleaseAndReadBuffer(), and GinBtreeData::rootBlkno.
Referenced by entryLoadMoreItems(), ginEntryInsert(), ginInsertItemPointers(), ginScanBeginPostingTree(), and startScanEntry().
IndexTuple GinFormTuple | ( | GinState * | ginstate, |
OffsetNumber | attnum, | ||
Datum | key, | ||
GinNullCategory | category, | ||
Pointer | data, | ||
Size | dataSize, | ||
int | nipd, | ||
bool | errorTooBig | ||
) |
Definition at line 45 of file ginentrypage.c.
References Assert(), attnum, data, ereport, errcode(), errmsg(), ERROR, GIN_CAT_NORM_KEY, GinCategoryOffset, GinGetPosting, GinMaxItemSize, GinSetNPosting, GinSetNullCategory, GinSetPostingOffset, GinState::index, index_form_tuple(), INDEX_SIZE_MASK, IndexTupleHasNulls, IndexTupleSize, sort-test::key, Max, MAXALIGN, GinState::oneCol, pfree(), RelationGetRelationName, repalloc(), SHORTALIGN, IndexTupleData::t_info, GinState::tupdesc, and UInt16GetDatum().
Referenced by addItemPointersToLeafTuple(), buildFreshLeafTuple(), ginHeapTupleFastCollect(), and ginVacuumEntryPage().
void ginFreeScanKeys | ( | GinScanOpaque | so | ) |
Definition at line 233 of file ginscan.c.
References GinScanEntryData::buffer, GinScanOpaqueData::entries, i, InvalidBuffer, GinScanOpaqueData::keyCtx, GinScanOpaqueData::keys, GinScanEntryData::list, GinScanEntryData::matchBitmap, GinScanEntryData::matchIterator, MemoryContextResetAndDeleteChildren, GinScanOpaqueData::nkeys, pfree(), ReleaseBuffer(), tbm_end_iterate(), tbm_free(), and GinScanOpaqueData::totalentries.
Referenced by ginendscan(), gingetbitmap(), and ginrescan().
ItemPointerData* ginGetBAEntry | ( | BuildAccumulator * | accum, |
OffsetNumber * | attnum, | ||
Datum * | key, | ||
GinNullCategory * | category, | ||
uint32 * | n | ||
) |
Definition at line 268 of file ginbulk.c.
References Assert(), GinEntryAccumulator::attnum, attnum, GinEntryAccumulator::category, GinEntryAccumulator::count, GinEntryAccumulator::key, sort-test::key, GinEntryAccumulator::list, sort-test::list, qsort, qsortCompareItemPointers(), rbt_iterate(), GinEntryAccumulator::shouldSort, and BuildAccumulator::tree_walk.
Referenced by ginbuild(), ginBuildCallback(), and ginInsertCleanup().
int64 gingetbitmap | ( | IndexScanDesc | scan, |
TIDBitmap * | tbm | ||
) |
Definition at line 1914 of file ginget.c.
References CHECK_FOR_INTERRUPTS, ginFreeScanKeys(), GinIsVoidRes, ginNewScanKey(), ItemPointerGetBlockNumber(), ItemPointerIsLossyPage, ItemPointerSetMin, IndexScanDescData::opaque, scanGetItem(), scanPendingInsert(), startScan(), tbm_add_page(), and tbm_add_tuples().
Referenced by ginhandler().
void ginHeapTupleFastCollect | ( | GinState * | ginstate, |
GinTupleCollector * | collector, | ||
OffsetNumber | attnum, | ||
Datum | value, | ||
bool | isNull, | ||
ItemPointer | ht_ctid | ||
) |
Definition at line 482 of file ginfast.c.
References attnum, elog(), ERROR, ginExtractEntries(), GinFormTuple(), i, IndexTupleSize, GinTupleCollector::lentuples, Max, MaxAllocSize, GinTupleCollector::ntuples, palloc_array, pg_nextpower2_32(), repalloc_array, GinTupleCollector::sumsize, IndexTupleData::t_tid, GinTupleCollector::tuples, and value.
Referenced by gininsert().
void ginHeapTupleFastInsert | ( | GinState * | ginstate, |
GinTupleCollector * | collector | ||
) |
Definition at line 219 of file ginfast.c.
References Assert(), BufferGetPage(), CheckForSerializableConflictIn(), data, elog(), END_CRIT_SECTION, ERROR, FirstOffsetNumber, GIN_EXCLUSIVE, GIN_METAPAGE_BLKNO, GIN_PAGE_FREESIZE, GIN_UNLOCK, GinGetPendingListCleanupSize, ginInsertCleanup(), GinListPageSize, GinPageGetMeta, GinPageGetOpaque, GinMetaPageData::head, i, GinState::index, IndexTupleSize, InvalidBlockNumber, InvalidBuffer, InvalidOffsetNumber, LockBuffer(), makeSublist(), MarkBufferDirty(), GinMetaPageData::nPendingHeapTuples, GinMetaPageData::nPendingPages, GinTupleCollector::ntuples, OffsetNumberNext, PageAddItem, PageGetExactFreeSpace(), PageGetMaxOffsetNumber(), PageIsEmpty(), PageSetLSN(), palloc(), ReadBuffer(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetRelationName, RelationNeedsWAL, START_CRIT_SECTION, GinTupleCollector::sumsize, GinMetaPageData::tail, GinMetaPageData::tailFreeSize, GinTupleCollector::tuples, UnlockReleaseBuffer(), XLOG_GIN_UPDATE_META_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gininsert().
void ginInitBA | ( | BuildAccumulator * | accum | ) |
Definition at line 109 of file ginbulk.c.
References BuildAccumulator::allocatedMemory, cmpEntryAccumulator(), BuildAccumulator::eas_used, BuildAccumulator::entryallocator, ginAllocEntryAccumulator(), ginCombineData(), rbt_create(), and BuildAccumulator::tree.
Referenced by ginbuild(), ginBuildCallback(), and ginInsertCleanup().
Definition at line 349 of file ginutil.c.
References b, BufferGetPage(), BufferGetPageSize(), and GinInitPage().
Referenced by ginbuild(), ginbuildempty(), ginRedoCreatePTree(), ginRedoDeleteListPages(), ginRedoInsertListPage(), and writeListPage().
void ginInitConsistentFunction | ( | GinState * | ginstate, |
GinScanKey | key | ||
) |
Definition at line 223 of file ginlogic.c.
References GinState::consistentFn, directBoolConsistentFn(), directTriConsistentFn(), FmgrInfo::fn_oid, GIN_SEARCH_MODE_EVERYTHING, sort-test::key, OidIsValid, shimBoolConsistentFn(), shimTriConsistentFn(), GinState::supportCollation, GinState::triConsistentFn, trueConsistentFn(), and trueTriConsistentFn().
Referenced by ginFillScanKey().
void GinInitMetabuffer | ( | Buffer | b | ) |
Definition at line 355 of file ginutil.c.
References b, BufferGetPage(), BufferGetPageSize(), GIN_CURRENT_VERSION, GIN_META, GinInitPage(), GinPageGetMeta, GinMetaPageData::ginVersion, GinMetaPageData::head, InvalidBlockNumber, GinMetaPageData::nDataPages, GinMetaPageData::nEntries, GinMetaPageData::nEntryPages, GinMetaPageData::nPendingHeapTuples, GinMetaPageData::nPendingPages, GinMetaPageData::nTotalPages, GinMetaPageData::tail, and GinMetaPageData::tailFreeSize.
Referenced by ginbuild(), ginbuildempty(), ginRedoDeleteListPages(), and ginRedoUpdateMetapage().
Definition at line 337 of file ginutil.c.
References GinPageOpaqueData::flags, GinPageGetOpaque, InvalidBlockNumber, PageInit(), and GinPageOpaqueData::rightlink.
Referenced by createPostingTree(), dataPlaceToPageLeafSplit(), dataSplitPageInternal(), entrySplitPage(), GinInitBuffer(), GinInitMetabuffer(), and ginPlaceToPage().
bool gininsert | ( | Relation | index, |
Datum * | values, | ||
bool * | isnull, | ||
ItemPointer | ht_ctid, | ||
Relation | heapRel, | ||
IndexUniqueCheck | checkUnique, | ||
bool | indexUnchanged, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 486 of file gininsert.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CurrentMemoryContext, GinGetUseFastUpdate, ginHeapTupleFastCollect(), ginHeapTupleFastInsert(), ginHeapTupleInsert(), i, if(), IndexInfo::ii_AmCache, IndexInfo::ii_Context, initGinState(), MemoryContextDelete(), MemoryContextSwitchTo(), TupleDescData::natts, GinState::origTupdesc, palloc(), and values.
Referenced by ginhandler().
void ginInsertBAEntries | ( | BuildAccumulator * | accum, |
ItemPointer | heapptr, | ||
OffsetNumber | attnum, | ||
Datum * | entries, | ||
GinNullCategory * | categories, | ||
int32 | nentries | ||
) |
Definition at line 210 of file ginbulk.c.
References Assert(), attnum, FirstOffsetNumber, ginInsertBAEntry(), i, and ItemPointerIsValid().
Referenced by ginHeapTupleBulkInsert(), and processPendingPage().
void ginInsertCleanup | ( | GinState * | ginstate, |
bool | full_clean, | ||
bool | fill_fsm, | ||
bool | forceCleanup, | ||
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 779 of file ginfast.c.
References BuildAccumulator::allocatedMemory, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert(), attnum, autovacuum_work_mem, BufferGetPage(), ConditionalLockPage(), CurrentMemoryContext, ExclusiveLock, FirstOffsetNumber, GIN_EXCLUSIVE, GIN_METAPAGE_BLKNO, GIN_SHARE, GIN_UNLOCK, ginBeginBAScan(), ginEntryInsert(), ginGetBAEntry(), ginInitBA(), GinPageGetMeta, GinPageGetOpaque, GinPageHasFullRow, GinPageIsDeleted, BuildAccumulator::ginstate, GinMetaPageData::head, GinState::index, IndexFreeSpaceMapVacuum(), initKeyArray(), InvalidBlockNumber, IsAutoVacuumWorkerProcess(), sort-test::key, sort-test::list, LockBuffer(), LockPage(), maintenance_work_mem, KeyArray::maxvalues, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), opCtx, PageGetMaxOffsetNumber(), processPendingPage(), ReadBuffer(), ReleaseBuffer(), shiftList(), GinMetaPageData::tail, UnlockPage(), UnlockReleaseBuffer(), vacuum_delay_point(), and work_mem.
Referenced by gin_clean_pending_list(), ginbulkdelete(), ginHeapTupleFastInsert(), and ginvacuumcleanup().
void ginInsertItemPointers | ( | Relation | index, |
BlockNumber | rootBlkno, | ||
ItemPointerData * | items, | ||
uint32 | nitem, | ||
GinStatsData * | buildStats | ||
) |
Definition at line 1902 of file gindatapage.c.
References GinBtreeDataLeafInsertData::curitem, ginFindLeafPage(), ginInsertValue(), ginPrepareDataScan(), GinBtreeData::isBuild, GinBtreeData::itemptr, GinBtreeDataLeafInsertData::items, and GinBtreeDataLeafInsertData::nitem.
Referenced by addItemPointersToLeafTuple(), createPostingTree(), and ginEntryInsert().
void ginInsertValue | ( | GinBtree | btree, |
GinBtreeStack * | stack, | ||
void * | insertdata, | ||
GinStatsData * | buildStats | ||
) |
Definition at line 773 of file ginbtree.c.
References GinBtreeStack::buffer, BufferGetPage(), freeGinBtreeStack(), GIN_UNLOCK, ginFinishSplit(), GinPageIsIncompleteSplit, ginPlaceToPage(), InvalidBlockNumber, InvalidBuffer, and LockBuffer().
Referenced by ginEntryInsert(), and ginInsertItemPointers().
ItemPointer ginMergeItemPointers | ( | ItemPointerData * | a, |
uint32 | na, | ||
ItemPointerData * | b, | ||
uint32 | nb, | ||
int * | nmerged | ||
) |
Definition at line 378 of file ginpostinglist.c.
References a, b, cmp(), ginCompareItemPointers(), and palloc().
Referenced by addItemPointersToLeafTuple(), addItemsToLeaf(), ginRedoRecompress(), and leafRepackItems().
Definition at line 299 of file ginutil.c.
References BMR_REL, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), GetFreeIndexPage(), GIN_UNLOCK, GinPageIsRecyclable(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, ReadBuffer(), and ReleaseBuffer().
Referenced by createPostingTree(), ginbuild(), ginPlaceToPage(), and makeSublist().
void ginNewScanKey | ( | IndexScanDesc | scan | ) |
Definition at line 263 of file ginscan.c.
References i, INDEX_MAX_KEYS, IndexScanDescData::keyData, and IndexScanDescData::opaque.
Referenced by gingetbitmap().
Definition at line 601 of file ginutil.c.
References build_reloptions(), lengthof, RELOPT_KIND_GIN, RELOPT_TYPE_BOOL, and RELOPT_TYPE_INT.
Referenced by ginhandler().
void GinPageDeletePostingItem | ( | Page | page, |
OffsetNumber | offset | ||
) |
Definition at line 417 of file gindatapage.c.
References Assert(), FirstOffsetNumber, GinDataPageGetPostingItem, GinDataPageSetDataSize, GinPageGetOpaque, and GinPageIsLeaf.
Referenced by ginDeletePage(), and ginRedoDeletePage().
ItemPointer ginPostingListDecode | ( | GinPostingList * | plist, |
int * | ndecoded_out | ||
) |
Definition at line 284 of file ginpostinglist.c.
References ginPostingListDecodeAllSegments(), and SizeOfGinPostingList.
Referenced by addItemsToLeaf(), dataBeginPlaceToPageLeaf(), gin_leafpage_items(), ginCompressPostingList(), ginReadTuple(), ginRedoRecompress(), ginVacuumEntryPage(), ginVacuumPostingTreeLeaf(), leafRepackItems(), and test_itemptr_pair().
ItemPointer ginPostingListDecodeAllSegments | ( | GinPostingList * | segment, |
int | len, | ||
int * | ndecoded_out | ||
) |
Definition at line 297 of file ginpostinglist.c.
References Assert(), GinPostingList::bytes, decode_varbyte(), GinPostingList::first, ginCompareItemPointers(), GinNextPostingListSegment, ItemPointerGetOffsetNumber(), itemptr_to_uint64(), len, GinPostingList::nbytes, OffsetNumberIsValid, palloc(), repalloc(), uint64_to_itemptr(), and val.
Referenced by GinDataLeafPageGetItems(), ginPostingListDecode(), and ginPostingListDecodeAllSegmentsToTbm().
int ginPostingListDecodeAllSegmentsToTbm | ( | GinPostingList * | ptr, |
int | len, | ||
TIDBitmap * | tbm | ||
) |
Definition at line 358 of file ginpostinglist.c.
References ginPostingListDecodeAllSegments(), len, pfree(), and tbm_add_tuples().
Referenced by GinDataLeafPageGetItemsToTbm().
void ginPrepareEntryScan | ( | GinBtree | btree, |
OffsetNumber | attnum, | ||
Datum | key, | ||
GinNullCategory | category, | ||
GinState * | ginstate | ||
) |
Definition at line 745 of file ginentrypage.c.
References attnum, GinBtreeData::beginPlaceToPage, GinBtreeData::entryAttnum, entryBeginPlaceToPage(), GinBtreeData::entryCategory, entryExecPlaceToPage(), entryFindChildPtr(), entryGetLeftMostPage(), entryIsMoveRight(), GinBtreeData::entryKey, entryLocateEntry(), entryLocateLeafEntry(), entryPrepareDownlink(), GinBtreeData::execPlaceToPage, GinBtreeData::fillRoot, GinBtreeData::findChildPage, GinBtreeData::findChildPtr, GinBtreeData::findItem, GinBtreeData::fullScan, GinBtreeData::getLeftMostChild, GIN_ROOT_BLKNO, ginEntryFillRoot(), GinBtreeData::ginstate, GinState::index, GinBtreeData::index, GinBtreeData::isBuild, GinBtreeData::isData, GinBtreeData::isMoveRight, sort-test::key, GinBtreeData::prepareDownlink, and GinBtreeData::rootBlkno.
Referenced by ginEntryInsert(), and startScanEntry().
ItemPointer ginReadTuple | ( | GinState * | ginstate, |
OffsetNumber | attnum, | ||
IndexTuple | itup, | ||
int * | nitems | ||
) |
Definition at line 163 of file ginentrypage.c.
References elog(), ERROR, GinGetNPosting, GinGetPosting, GinItupIsCompressed, ginPostingListDecode(), nitems, and palloc().
Referenced by addItemPointersToLeafTuple(), collectMatchBitmap(), and startScanEntry().
void ginrescan | ( | IndexScanDesc | scan, |
ScanKey | scankey, | ||
int | nscankeys, | ||
ScanKey | orderbys, | ||
int | norderbys | ||
) |
Definition at line 442 of file ginscan.c.
References ginFreeScanKeys(), IndexScanDescData::keyData, IndexScanDescData::numberOfKeys, and IndexScanDescData::opaque.
Referenced by ginhandler().
GinBtreeStack* ginScanBeginPostingTree | ( | GinBtree | btree, |
Relation | index, | ||
BlockNumber | rootBlkno | ||
) |
Definition at line 1930 of file gindatapage.c.
References GinBtreeData::fullScan, ginFindLeafPage(), and ginPrepareDataScan().
Referenced by scanPostingTree(), and startScanEntry().
Definition at line 171 of file ginbtree.c.
References BufferGetPage(), elog(), ERROR, GinPageGetOpaque, GinPageIsData, GinPageIsLeaf, LockBuffer(), ReadBuffer(), and UnlockReleaseBuffer().
Referenced by entryLoadMoreItems(), ginFindLeafPage(), ginFindParents(), ginFinishSplit(), moveRightIfItNeeded(), and scanPostingTree().
Definition at line 36 of file ginbtree.c.
References BufferGetPage(), GIN_EXCLUSIVE, GIN_SHARE, GIN_UNLOCK, GinPageIsLeaf, and LockBuffer().
Referenced by ginFindLeafPage().
OffsetNumber gintuple_get_attrnum | ( | GinState * | ginstate, |
IndexTuple | tuple | ||
) |
Definition at line 225 of file ginutil.c.
References Assert(), DatumGetUInt16(), FirstOffsetNumber, index_getattr(), GinState::oneCol, res, and GinState::tupdesc.
Referenced by addItemPointersToLeafTuple(), collectMatchBitmap(), collectMatchesForHeapRow(), entryIsMoveRight(), entryLocateEntry(), entryLocateLeafEntry(), gintuple_get_key(), ginVacuumEntryPage(), matchPartialInPendingList(), and processPendingPage().
Datum gintuple_get_key | ( | GinState * | ginstate, |
IndexTuple | tuple, | ||
GinNullCategory * | category | ||
) |
Definition at line 258 of file ginutil.c.
References FirstOffsetNumber, GIN_CAT_NORM_KEY, GinGetNullCategory, gintuple_get_attrnum(), index_getattr(), OffsetNumberNext, GinState::oneCol, GinState::origTupdesc, res, and GinState::tupdesc.
Referenced by addItemPointersToLeafTuple(), collectMatchBitmap(), collectMatchesForHeapRow(), entryIsMoveRight(), entryLocateEntry(), entryLocateLeafEntry(), ginVacuumEntryPage(), matchPartialInPendingList(), and processPendingPage().
IndexBulkDeleteResult* ginvacuumcleanup | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 688 of file ginvacuum.c.
References IndexVacuumInfo::analyze_only, Assert(), DataPageDeleteStack::blkno, BufferGetPage(), IndexVacuumInfo::estimated_count, IndexBulkDeleteResult::estimated_count, ExclusiveLock, GIN_ROOT_BLKNO, GIN_SHARE, ginInsertCleanup(), GinPageIsData, GinPageIsLeaf, GinPageIsList, GinPageIsRecyclable(), ginUpdateStats(), IndexVacuumInfo::index, IndexFreeSpaceMapVacuum(), initGinState(), IsAutoVacuumWorkerProcess(), LockBuffer(), LockRelationForExtension(), MAIN_FORKNUM, Max, GinStatsData::nDataPages, GinStatsData::nEntries, GinStatsData::nEntryPages, GinStatsData::nTotalPages, IndexVacuumInfo::num_heap_tuples, IndexBulkDeleteResult::num_index_tuples, IndexBulkDeleteResult::num_pages, PageGetMaxOffsetNumber(), IndexBulkDeleteResult::pages_free, palloc0(), RBM_NORMAL, ReadBufferExtended(), RecordFreeIndexPage(), RELATION_IS_LOCAL, RelationGetNumberOfBlocks, IndexVacuumInfo::strategy, UnlockRelationForExtension(), UnlockReleaseBuffer(), and vacuum_delay_point().
Referenced by ginhandler().
ItemPointer ginVacuumItemPointers | ( | GinVacuumState * | gvs, |
ItemPointerData * | items, | ||
int | nitem, | ||
int * | nremaining | ||
) |
Definition at line 48 of file ginvacuum.c.
References GinVacuumState::callback, GinVacuumState::callback_state, i, IndexBulkDeleteResult::num_index_tuples, palloc(), remaining, GinVacuumState::result, and IndexBulkDeleteResult::tuples_removed.
Referenced by ginVacuumEntryPage(), and ginVacuumPostingTreeLeaf().
void ginVacuumPostingTreeLeaf | ( | Relation | indexrel, |
Buffer | buffer, | ||
GinVacuumState * | gvs | ||
) |
Definition at line 735 of file gindatapage.c.
References leafSegmentInfo::action, BufferGetPage(), computeLeafRecompressWALData(), dlist_iter::cur, dataPlaceToPageLeafRecompress(), disassembleLeaf(), dlist_container, dlist_foreach, elog(), END_CRIT_SECTION, ERROR, GIN_SEGMENT_DELETE, GIN_SEGMENT_REPLACE, GIN_SEGMENT_UNMODIFIED, ginCompressPostingList(), GinDataPageMaxDataSize, ginPostingListDecode(), ginVacuumItemPointers(), leafSegmentInfo::items, MarkBufferDirty(), leafSegmentInfo::nitems, PageSetLSN(), palloc(), pfree(), REGBUF_STANDARD, RelationNeedsWAL, leafSegmentInfo::seg, disassembledLeaf::segments, SizeOfGinPostingList, START_CRIT_SECTION, disassembledLeaf::walinfo, disassembledLeaf::walinfolen, XLOG_GIN_VACUUM_DATA_LEAF_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), and XLogRegisterBuffer().
Referenced by ginVacuumPostingTreeLeaves().
Definition at line 33 of file ginvalidate.c.
References AMOPSTRATEGY, AMPROCNUM, check_amop_signature(), check_amoptsproc_signature(), check_amproc_signature(), CLAOID, elog(), ereport, errcode(), errmsg(), ERROR, format_operator(), format_procedure(), OpFamilyOpFuncGroup::functionset, GETSTRUCT, GIN_COMPARE_PARTIAL_PROC, GIN_COMPARE_PROC, GIN_CONSISTENT_PROC, GIN_EXTRACTQUERY_PROC, GIN_EXTRACTVALUE_PROC, GIN_OPTIONS_PROC, GIN_TRICONSISTENT_PROC, GINNProcs, HeapTupleIsValid, i, identify_opfamily_groups(), INFO, OpFamilyOpFuncGroup::lefttype, lfirst, catclist::members, catclist::n_members, NameStr, ObjectIdGetDatum(), OidIsValid, OPFAMILYOID, ReleaseCatCacheList(), ReleaseSysCache(), OpFamilyOpFuncGroup::righttype, SearchSysCache1(), SearchSysCacheList1, and catctup::tuple.
Referenced by ginhandler().
Definition at line 96 of file ginutil.c.
References TypeCacheEntry::cmp_proc_finfo, CreateTemplateTupleDesc(), CurrentMemoryContext, elog(), ereport, errcode(), errmsg(), ERROR, fmgr_info_copy(), FmgrInfo::fn_oid, format_type_be(), GIN_COMPARE_PARTIAL_PROC, GIN_COMPARE_PROC, GIN_CONSISTENT_PROC, GIN_EXTRACTQUERY_PROC, GIN_EXTRACTVALUE_PROC, GIN_TRICONSISTENT_PROC, i, index_getprocid(), index_getprocinfo(), InvalidOid, lookup_type_cache(), MemSet, TupleDescData::natts, OidIsValid, RelationGetDescr, RelationGetRelationName, TupleDescAttr, TupleDescInitEntry(), TupleDescInitEntryCollation(), and TYPECACHE_CMP_PROC_FINFO.
Referenced by gin_clean_pending_list(), ginbeginscan(), ginbuild(), ginbulkdelete(), gininsert(), and ginvacuumcleanup().