PostgreSQL Source Code
git master
|
#include "access/amapi.h"
#include "access/gist.h"
#include "access/itup.h"
#include "fmgr.h"
#include "lib/pairingheap.h"
#include "storage/bufmgr.h"
#include "storage/buffile.h"
#include "utils/hsearch.h"
#include "access/genam.h"
Go to the source code of this file.
Data Structures | |
struct | GISTNodeBufferPage |
struct | GISTSTATE |
struct | GISTSearchHeapItem |
struct | GISTSearchItem |
struct | GISTScanOpaqueData |
struct | gistxlogPage |
struct | SplitedPageLayout |
struct | GISTInsertStack |
struct | GistSplitVector |
struct | GISTInsertState |
struct | GISTNodeBuffer |
struct | GISTBuildBuffers |
struct | GiSTOptions |
struct | GISTPageSplitInfo |
Macros | |
#define | GIST_MAX_SPLIT_PAGES 75 |
#define | GIST_SHARE BUFFER_LOCK_SHARE |
#define | GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE |
#define | GIST_UNLOCK BUFFER_LOCK_UNLOCK |
#define | BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) |
#define | PAGE_FREE_SPACE(nbp) (nbp->freespace) |
#define | PAGE_IS_EMPTY(nbp) (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) |
#define | PAGE_NO_SPACE(nbp, itup) |
#define | GISTSearchItemIsHeap(item) ((item).blkno == InvalidBlockNumber) |
#define | SizeOfGISTSearchItem(n_distances) (offsetof(GISTSearchItem, distances) + sizeof(double) * (n_distances)) |
#define | GIST_ROOT_BLKNO 0 |
#define | TUPLE_IS_VALID 0xffff |
#define | TUPLE_IS_INVALID 0xfffe |
#define | GistTupleIsInvalid(itup) ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) |
#define | GistTupleSetValid(itup) ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) |
#define | LEVEL_HAS_BUFFERS(nlevel, gfbb) |
#define | BUFFER_HALF_FILLED(nodeBuffer, gfbb) ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) |
#define | BUFFER_OVERFLOWED(nodeBuffer, gfbb) ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) |
#define | GiSTPageSize ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) |
#define | GIST_MIN_FILLFACTOR 10 |
#define | GIST_DEFAULT_FILLFACTOR 90 |
Typedefs | |
typedef struct GISTSTATE | GISTSTATE |
typedef struct GISTSearchHeapItem | GISTSearchHeapItem |
typedef struct GISTSearchItem | GISTSearchItem |
typedef struct GISTScanOpaqueData | GISTScanOpaqueData |
typedef GISTScanOpaqueData * | GISTScanOpaque |
typedef struct gistxlogPage | gistxlogPage |
typedef struct SplitedPageLayout | SplitedPageLayout |
typedef struct GISTInsertStack | GISTInsertStack |
typedef struct GistSplitVector | GistSplitVector |
typedef struct GISTBuildBuffers | GISTBuildBuffers |
typedef struct GiSTOptions | GiSTOptions |
#define BUFFER_HALF_FILLED | ( | nodeBuffer, | |
gfbb | |||
) | ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) |
Definition at line 311 of file gist_private.h.
Referenced by gistPushItupToNodeBuffer().
#define BUFFER_OVERFLOWED | ( | nodeBuffer, | |
gfbb | |||
) | ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) |
Definition at line 319 of file gist_private.h.
Referenced by gistProcessItup().
#define BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) |
Definition at line 54 of file gist_private.h.
Referenced by gistAllocateNewPageBuffer(), gistGetItupFromPage(), and gistPlaceItupToPage().
#define GIST_DEFAULT_FILLFACTOR 90 |
Definition at line 436 of file gist_private.h.
Referenced by gistbuild().
#define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE |
Definition at line 44 of file gist_private.h.
Referenced by gistBufferingFindCorrectParent(), gistbulkdelete(), gistdoinsert(), gistFindCorrectParent(), gistfinishsplit(), gistfixsplit(), gistformdownlink(), gistNewBuffer(), and gistProcessItup().
#define GIST_MAX_SPLIT_PAGES 75 |
Definition at line 40 of file gist_private.h.
Referenced by gistplacetopage().
#define GIST_MIN_FILLFACTOR 10 |
Definition at line 435 of file gist_private.h.
#define GIST_ROOT_BLKNO 0 |
Definition at line 249 of file gist_private.h.
Referenced by gistbufferinginserttuples(), gistbuild(), gistbulkdelete(), gistdoinsert(), gistFindPath(), gistgetbitmap(), gistGetMaxLevel(), gistgettuple(), gistplacetopage(), gistRedoCreateIndex(), gistRedoPageSplitRecord(), gistRelocateBuildBuffersOnSplit(), gistvacuumcleanup(), pgstat_relation(), and pushStackIfSplited().
#define GIST_SHARE BUFFER_LOCK_SHARE |
Definition at line 43 of file gist_private.h.
Referenced by gistbufferinginserttuples(), gistbulkdelete(), gistdoinsert(), gistFindPath(), gistGetMaxLevel(), gistkillitems(), gistScanPage(), gistvacuumcleanup(), and pgstat_gist_page().
#define GIST_UNLOCK BUFFER_LOCK_UNLOCK |
Definition at line 45 of file gist_private.h.
Referenced by gistbulkdelete(), gistdoinsert(), gistformdownlink(), gistinserttuples(), and gistNewBuffer().
#define GiSTPageSize ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) |
Definition at line 432 of file gist_private.h.
Referenced by gistfitpage(), and gistSplit().
#define GISTSearchItemIsHeap | ( | item | ) | ((item).blkno == InvalidBlockNumber) |
Definition at line 143 of file gist_private.h.
Referenced by getNextNearest(), gistScanPage(), and pairingheap_GISTSearchItem_cmp().
#define GistTupleIsInvalid | ( | itup | ) | ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) |
Definition at line 275 of file gist_private.h.
Referenced by gistbulkdelete(), gistdoinsert(), and gistindex_keytest().
#define GistTupleSetValid | ( | itup | ) | ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) |
Definition at line 276 of file gist_private.h.
Referenced by gistformdownlink(), and gistplacetopage().
#define LEVEL_HAS_BUFFERS | ( | nlevel, | |
gfbb | |||
) |
Definition at line 306 of file gist_private.h.
Referenced by gistProcessItup(), and gistRelocateBuildBuffersOnSplit().
#define PAGE_FREE_SPACE | ( | nbp | ) | (nbp->freespace) |
Definition at line 56 of file gist_private.h.
Referenced by gistAllocateNewPageBuffer(), gistGetItupFromPage(), gistPlaceItupToPage(), and gistPushItupToNodeBuffer().
#define PAGE_IS_EMPTY | ( | nbp | ) | (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) |
Definition at line 58 of file gist_private.h.
Referenced by gistGetItupFromPage(), and gistPopItupFromNodeBuffer().
#define PAGE_NO_SPACE | ( | nbp, | |
itup | |||
) |
Definition at line 60 of file gist_private.h.
Referenced by gistPushItupToNodeBuffer().
#define SizeOfGISTSearchItem | ( | n_distances | ) | (offsetof(GISTSearchItem, distances) + sizeof(double) * (n_distances)) |
Definition at line 145 of file gist_private.h.
Referenced by gistScanPage().
#define TUPLE_IS_INVALID 0xfffe |
Definition at line 273 of file gist_private.h.
#define TUPLE_IS_VALID 0xffff |
Definition at line 272 of file gist_private.h.
typedef struct GiSTOptions GiSTOptions |
Definition at line 177 of file gist_private.h.
typedef struct GISTSearchItem GISTSearchItem |
typedef struct gistxlogPage gistxlogPage |
MemoryContext createTempGistContext | ( | void | ) |
Definition at line 113 of file gist.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, and CurrentMemoryContext.
Referenced by gist_xlog_startup(), gistbeginscan(), gistbuild(), and gistinsert().
void freeGISTstate | ( | GISTSTATE * | giststate | ) |
Definition at line 1535 of file gist.c.
References MemoryContextDelete(), and GISTSTATE::scanCxt.
Referenced by gistbuild(), and gistendscan().
IndexBuildResult* gistbuild | ( | Relation | heap, |
Relation | index, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 114 of file gistbuild.c.
References Assert, buffer, BufferGetBlockNumber(), BufferGetPage, GISTBuildState::bufferingMode, GiSTOptions::bufferingModeOffset, createTempGistContext(), CurrentMemoryContext, DEBUG1, elog, END_CRIT_SECTION, ERROR, F_LEAF, fillfactor, GiSTOptions::fillfactor, freeGISTstate(), GISTBuildState::freespace, GIST_BUFFERING_ACTIVE, GIST_BUFFERING_AUTO, GIST_BUFFERING_DISABLED, GIST_BUFFERING_STATS, GIST_DEFAULT_FILLFACTOR, GIST_ROOT_BLKNO, gistBuildCallback(), gistEmptyAllBuffers(), gistFreeBuildBuffers(), gistGetFakeLSN(), GISTInitBuffer(), gistNewBuffer(), GISTBuildState::giststate, IndexBuildResult::heap_tuples, IndexBuildResult::index_tuples, IndexBuildHeapScan(), GISTBuildState::indexrel, GISTBuildState::indtuples, GISTBuildState::indtuplesSize, initGISTstate(), MarkBufferDirty(), MemoryContextDelete(), MemoryContextSwitchTo(), PageSetLSN, palloc(), RelationData::rd_options, REGBUF_WILL_INIT, RelationGetNumberOfBlocks, RelationGetRelationName, RelationNeedsWAL, reltuples, START_CRIT_SECTION, GISTSTATE::tempCxt, UnlockReleaseBuffer(), XLOG_GIST_CREATE_INDEX, XLogBeginInsert(), XLogInsert(), and XLogRegisterBuffer().
Referenced by gisthandler().
void gistbuildempty | ( | Relation | index | ) |
Definition at line 124 of file gist.c.
References buffer, BUFFER_LOCK_EXCLUSIVE, END_CRIT_SECTION, F_LEAF, GISTInitBuffer(), INIT_FORKNUM, LockBuffer(), log_newpage_buffer(), MarkBufferDirty(), P_NEW, RBM_NORMAL, ReadBufferExtended(), START_CRIT_SECTION, and UnlockReleaseBuffer().
Referenced by gisthandler().
IndexBulkDeleteResult* gistbulkdelete | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats, | ||
IndexBulkDeleteCallback | callback, | ||
void * | callback_state | ||
) |
Definition at line 138 of file gistvacuum.c.
References GistBDItem::blkno, buffer, BufferGetLSNAtomic(), BufferGetPage, callback(), END_CRIT_SECTION, ereport, errdetail(), errhint(), errmsg(), IndexBulkDeleteResult::estimated_count, FirstOffsetNumber, GIST_EXCLUSIVE, GIST_ROOT_BLKNO, GIST_SHARE, GIST_UNLOCK, gistcheckpage(), gistGetFakeLSN(), GistMarkTuplesDeleted, GistPageIsLeaf, GistTupleIsInvalid, gistXLogUpdate(), i, IndexVacuumInfo::index, InvalidBuffer, ItemPointerGetBlockNumber, LockBuffer(), LOG, MAIN_FORKNUM, MarkBufferDirty(), MaxOffsetNumber, GistBDItem::next, IndexBulkDeleteResult::num_index_tuples, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, PageIndexMultiDelete(), PageSetLSN, palloc(), palloc0(), GistBDItem::parentlsn, pfree(), pushStackIfSplited(), RBM_NORMAL, ReadBufferExtended(), RelationGetRelationName, RelationNeedsWAL, START_CRIT_SECTION, IndexVacuumInfo::strategy, IndexTupleData::t_tid, IndexBulkDeleteResult::tuples_removed, UnlockReleaseBuffer(), and vacuum_delay_point().
Referenced by gisthandler().
Definition at line 810 of file gistget.c.
References GIST_COMPRESS_PROC, GIST_FETCH_PROC, index_getprocid(), and OidIsValid.
Referenced by gisthandler().
Definition at line 743 of file gistutil.c.
References BufferGetBlockNumber(), BufferGetPage, ereport, errcode(), errhint(), errmsg(), ERROR, MAXALIGN, PageGetSpecialSize, PageIsNew, and RelationGetRelationName.
Referenced by gistBufferingFindCorrectParent(), gistbulkdelete(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistkillitems(), gistNewBuffer(), gistScanPage(), and pgstat_gist_page().
OffsetNumber gistchoose | ( | Relation | r, |
Page | p, | ||
IndexTuple | it, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 372 of file gistutil.c.
References Assert, FirstOffsetNumber, gistDeCompressAtt(), gistdentryinit(), GistPageIsLeaf, gistpenalty(), i, index_getattr, INDEX_MAX_KEYS, MAX_RANDOM_VALUE, tupleDesc::natts, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, random(), RelationData::rd_att, and GISTSTATE::tupdesc.
Referenced by gistdoinsert(), and gistProcessItup().
void gistDeCompressAtt | ( | GISTSTATE * | giststate, |
Relation | r, | ||
IndexTuple | tuple, | ||
Page | p, | ||
OffsetNumber | o, | ||
GISTENTRY * | attdata, | ||
bool * | isnull | ||
) |
Definition at line 294 of file gistutil.c.
References gistdentryinit(), i, index_getattr, tupleDesc::natts, RelationData::rd_att, and GISTSTATE::tupdesc.
Referenced by gistchoose(), gistgetadjusted(), gistRelocateBuildBuffersOnSplit(), and placeOne().
void gistdentryinit | ( | GISTSTATE * | giststate, |
int | nkey, | ||
GISTENTRY * | e, | ||
Datum | k, | ||
Relation | r, | ||
Page | pg, | ||
OffsetNumber | o, | ||
bool | l, | ||
bool | isNull | ||
) |
Definition at line 544 of file gistutil.c.
References DatumGetPointer, GISTSTATE::decompressFn, FmgrInfo::fn_oid, FunctionCall1Coll(), gistentryinit, GISTENTRY::key, GISTENTRY::leafkey, GISTENTRY::offset, OidIsValid, GISTENTRY::page, PointerGetDatum, GISTENTRY::rel, and GISTSTATE::supportCollation.
Referenced by gistchoose(), gistDeCompressAtt(), gistindex_keytest(), gistMakeUnionItVec(), and gistSplitByKey().
void gistdoinsert | ( | Relation | r, |
IndexTuple | itup, | ||
Size | freespace, | ||
GISTSTATE * | GISTstate | ||
) |
Definition at line 607 of file gist.c.
References Assert, GISTInsertStack::blkno, GISTInsertStack::buffer, BufferGetLSNAtomic(), BufferGetPage, GISTInsertStack::downlinkoffnum, ereport, errdetail(), errhint(), errmsg(), ERROR, GISTInsertState::freespace, GIST_EXCLUSIVE, GIST_ROOT_BLKNO, GIST_SHARE, GIST_UNLOCK, gistcheckpage(), gistchoose(), gistfixsplit(), GistFollowRight, gistgetadjusted(), gistinserttuple(), GistPageGetNSN, GistPageIsLeaf, GistTupleIsInvalid, InvalidOffsetNumber, ItemPointerGetBlockNumber, LockBuffer(), GISTInsertStack::lsn, GISTInsertStack::page, PageGetItem, PageGetItemId, PageGetLSN, palloc0(), GISTInsertStack::parent, GISTInsertState::r, ReadBuffer(), RelationGetRelationName, RelationNeedsWAL, ReleaseBuffer(), GISTInsertState::stack, IndexTupleData::t_tid, UnlockReleaseBuffer(), and XLogRecPtrIsInvalid.
Referenced by gistBuildCallback(), and gistinsert().
IndexTuple* gistextractpage | ( | Page | page, |
int * | len | ||
) |
Definition at line 94 of file gistutil.c.
References FirstOffsetNumber, i, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, and palloc().
Referenced by gistplacetopage().
HeapTuple gistFetchTuple | ( | GISTSTATE * | giststate, |
Relation | r, | ||
IndexTuple | tuple | ||
) |
Definition at line 640 of file gistutil.c.
References GISTSTATE::compressFn, fetchatt, GISTSTATE::fetchFn, GISTSTATE::fetchTupdesc, FmgrInfo::fn_oid, gistFetchAtt(), heap_form_tuple(), i, index_getattr, INDEX_MAX_KEYS, InvalidOid, MemoryContextSwitchTo(), tupleDesc::natts, RelationData::rd_att, GISTSTATE::tempCxt, and GISTSTATE::tupdesc.
Referenced by gistScanPage().
void gistfillbuffer | ( | Page | page, |
IndexTuple * | itup, | ||
int | len, | ||
OffsetNumber | off | ||
) |
Definition at line 33 of file gistutil.c.
References elog, ERROR, FirstOffsetNumber, i, IndexTupleSize, InvalidOffsetNumber, OffsetNumberNext, PageAddItem, PageGetMaxOffsetNumber, and PageIsEmpty.
Referenced by gistplacetopage(), and gistRedoPageSplitRecord().
IndexTupleData* gistfillitupvec | ( | IndexTuple * | vec, |
int | veclen, | ||
int * | memlen | ||
) |
Definition at line 126 of file gistutil.c.
References i, IndexTupleSize, and palloc().
Referenced by gistplacetopage(), and gistSplit().
bool gistfitpage | ( | IndexTuple * | itvec, |
int | len | ||
) |
Definition at line 78 of file gistutil.c.
References GiSTPageSize, i, and IndexTupleSize.
Referenced by gistSplit().
IndexTuple gistFormTuple | ( | GISTSTATE * | giststate, |
Relation | r, | ||
Datum * | attdata, | ||
bool * | isnull, | ||
bool | isleaf | ||
) |
void gistFreeBuildBuffers | ( | GISTBuildBuffers * | gfbb | ) |
Definition at line 511 of file gistbuildbuffers.c.
References BufFileClose(), and GISTBuildBuffers::pfile.
Referenced by gistbuild().
IndexTuple gistgetadjusted | ( | Relation | r, |
IndexTuple | oldtup, | ||
IndexTuple | addtup, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 314 of file gistutil.c.
References gistDeCompressAtt(), gistFormTuple(), gistKeyIsEQ(), gistMakeUnionKey(), i, INDEX_MAX_KEYS, tupleDesc::natts, RelationData::rd_att, and IndexTupleData::t_tid.
Referenced by gistdoinsert(), gistformdownlink(), gistProcessItup(), and gistRelocateBuildBuffersOnSplit().
int64 gistgetbitmap | ( | IndexScanDesc | scan, |
TIDBitmap * | tbm | ||
) |
Definition at line 761 of file gistget.c.
References CHECK_FOR_INTERRUPTS, GISTScanOpaqueData::curPageData, GISTSearchItem::distances, getNextGISTSearchItem(), GIST_ROOT_BLKNO, gistScanPage(), IndexScanDescData::indexRelation, MemoryContextReset(), GISTScanOpaqueData::nPageData, IndexScanDescData::opaque, GISTScanOpaqueData::pageDataCxt, pfree(), pgstat_count_index_scan, GISTScanOpaqueData::qual_ok, and IndexScanDescData::xs_hitup.
Referenced by gisthandler().
XLogRecPtr gistGetFakeLSN | ( | Relation | rel | ) |
Definition at line 980 of file gistutil.c.
References Assert, GetFakeLSNForUnloggedRel(), and RelationData::rd_rel.
Referenced by gistbuild(), gistbulkdelete(), gistplacetopage(), and gistvacuumpage().
GISTNodeBuffer* gistGetNodeBuffer | ( | GISTBuildBuffers * | gfbb, |
GISTSTATE * | giststate, | ||
BlockNumber | blkno, | ||
int | level | ||
) |
Definition at line 118 of file gistbuildbuffers.c.
References GISTNodeBuffer::blocksCount, GISTBuildBuffers::buffersOnLevels, GISTBuildBuffers::buffersOnLevelsLen, GISTBuildBuffers::context, HASH_ENTER, hash_search(), i, InvalidBlockNumber, lcons(), GISTNodeBuffer::level, MemoryContextSwitchTo(), NIL, GISTBuildBuffers::nodeBuffersTab, GISTNodeBuffer::pageBlocknum, GISTNodeBuffer::pageBuffer, GISTNodeBuffer::queuedForEmptying, and repalloc().
Referenced by gistProcessItup(), and gistRelocateBuildBuffersOnSplit().
bool gistgettuple | ( | IndexScanDesc | scan, |
ScanDirection | dir | ||
) |
Definition at line 630 of file gistget.c.
References GISTSearchItem::blkno, CHECK_FOR_INTERRUPTS, GISTScanOpaqueData::curBlkno, GISTScanOpaqueData::curPageData, GISTSearchItem::data, GISTSearchItem::distances, elog, ERROR, GISTScanOpaqueData::firstCall, ForwardScanDirection, getNextGISTSearchItem(), getNextNearest(), GIST_ROOT_BLKNO, gistkillitems(), gistScanPage(), GISTScanOpaqueData::giststate, GISTSearchHeapItem::heapPtr, IndexScanDescData::indexRelation, InvalidBlockNumber, IndexScanDescData::kill_prior_tuple, GISTScanOpaqueData::killedItems, MaxIndexTuplesPerPage, MemoryContextReset(), MemoryContextSwitchTo(), GISTScanOpaqueData::nPageData, IndexScanDescData::numberOfOrderBys, GISTScanOpaqueData::numKilled, GISTSearchHeapItem::offnum, IndexScanDescData::opaque, GISTScanOpaqueData::pageData, GISTScanOpaqueData::pageDataCxt, palloc(), GISTSearchItem::parentlsn, pfree(), pgstat_count_index_scan, GISTScanOpaqueData::qual_ok, GISTSearchHeapItem::recheck, GISTSearchHeapItem::recontup, GISTSTATE::scanCxt, HeapTupleData::t_self, IndexScanDescData::xs_ctup, IndexScanDescData::xs_hitup, IndexScanDescData::xs_recheck, and IndexScanDescData::xs_want_itup.
Referenced by gisthandler().
Definition at line 721 of file gistutil.c.
References BufferGetPage, BufferGetPageSize, GISTPageOpaqueData::flags, GISTPageOpaqueData::gist_page_id, GIST_PAGE_ID, GistPageGetOpaque, InvalidBlockNumber, PageInit(), and GISTPageOpaqueData::rightlink.
Referenced by gistbuild(), gistbuildempty(), gistplacetopage(), gistRedoCreateIndex(), and gistRedoPageSplitRecord().
GISTBuildBuffers* gistInitBuildBuffers | ( | int | pagesPerBuffer, |
int | levelStep, | ||
int | maxLevel | ||
) |
Definition at line 48 of file gistbuildbuffers.c.
References GISTBuildBuffers::bufferEmptyingQueue, GISTBuildBuffers::buffersOnLevels, GISTBuildBuffers::buffersOnLevelsLen, BufFileCreateTemp(), GISTBuildBuffers::context, CurrentMemoryContext, HASHCTL::entrysize, GISTBuildBuffers::freeBlocks, GISTBuildBuffers::freeBlocksLen, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASHCTL::hcxt, HASHCTL::keysize, GISTBuildBuffers::levelStep, GISTBuildBuffers::loadedBuffers, GISTBuildBuffers::loadedBuffersCount, GISTBuildBuffers::loadedBuffersLen, GISTBuildBuffers::nFileBlocks, GISTBuildBuffers::nFreeBlocks, NIL, GISTBuildBuffers::nodeBuffersTab, GISTBuildBuffers::pagesPerBuffer, palloc(), GISTBuildBuffers::pfile, and GISTBuildBuffers::rootlevel.
Referenced by gistInitBuffering().
bool gistinsert | ( | Relation | r, |
Datum * | values, | ||
bool * | isnull, | ||
ItemPointer | ht_ctid, | ||
Relation | heapRel, | ||
IndexUniqueCheck | checkUnique, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 150 of file gist.c.
References createTempGistContext(), gistdoinsert(), gistFormTuple(), IndexInfo::ii_AmCache, IndexInfo::ii_Context, initGISTstate(), MemoryContextReset(), MemoryContextSwitchTo(), and GISTSTATE::tempCxt.
Referenced by gisthandler().
IndexTuple* gistjoinvector | ( | IndexTuple * | itvec, |
int * | len, | ||
IndexTuple * | additvec, | ||
int | addlen | ||
) |
Definition at line 113 of file gistutil.c.
References memmove, and repalloc().
Referenced by gistplacetopage().
Definition at line 279 of file gistutil.c.
References GISTSTATE::equalFn, FunctionCall3Coll(), PointerGetDatum, and GISTSTATE::supportCollation.
Referenced by gistgetadjusted(), and gistUserPicksplit().
void gistMakeUnionItVec | ( | GISTSTATE * | giststate, |
IndexTuple * | itvec, | ||
int | len, | ||
Datum * | attr, | ||
bool * | isnull | ||
) |
Definition at line 154 of file gistutil.c.
References FunctionCall2Coll(), GEVHDRSZ, gistdentryinit(), i, index_getattr, GistEntryVector::n, tupleDesc::natts, palloc(), PointerGetDatum, GISTSTATE::supportCollation, GISTSTATE::tupdesc, GISTSTATE::unionFn, and GistEntryVector::vector.
Referenced by gistunion(), and gistunionsubkeyvec().
void gistMakeUnionKey | ( | GISTSTATE * | giststate, |
int | attno, | ||
GISTENTRY * | entry1, | ||
bool | isnull1, | ||
GISTENTRY * | entry2, | ||
bool | isnull2, | ||
Datum * | dst, | ||
bool * | dstisnull | ||
) |
Definition at line 231 of file gistutil.c.
References FunctionCall2Coll(), GEVHDRSZ, GistEntryVector::n, PointerGetDatum, GISTSTATE::supportCollation, GISTSTATE::unionFn, and GistEntryVector::vector.
Referenced by gistgetadjusted(), and supportSecondarySplit().
Definition at line 782 of file gistutil.c.
References DataPageDeleteStack::blkno, buffer, BufferGetPage, ConditionalLockBuffer(), ExclusiveLock, GetFreeIndexPage(), GIST_EXCLUSIVE, GIST_UNLOCK, gistcheckpage(), GistPageIsDeleted, InvalidBlockNumber, LockBuffer(), LockRelationForExtension(), P_NEW, PageIsNew, ReadBuffer(), RELATION_IS_LOCAL, ReleaseBuffer(), and UnlockRelationForExtension().
Referenced by gistbuild(), and gistplacetopage().
bool gistnospace | ( | Page | page, |
IndexTuple * | itvec, | ||
int | len, | ||
OffsetNumber | todelete, | ||
Size | freespace | ||
) |
Definition at line 58 of file gistutil.c.
References i, IndexTupleSize, InvalidOffsetNumber, PageGetFreeSpace(), PageGetItem, and PageGetItemId.
Referenced by gistplacetopage().
Definition at line 836 of file gistutil.c.
References allocateReloptStruct(), fillfactor, fillRelOptions(), lengthof, offsetof, options, parseRelOptions(), pfree(), RELOPT_KIND_GIST, RELOPT_TYPE_INT, and RELOPT_TYPE_STRING.
Referenced by gisthandler().
float gistpenalty | ( | GISTSTATE * | giststate, |
int | attno, | ||
GISTENTRY * | key1, | ||
bool | isNull1, | ||
GISTENTRY * | key2, | ||
bool | isNull2 | ||
) |
Definition at line 688 of file gistutil.c.
References FmgrInfo::fn_strict, FunctionCall3Coll(), get_float4_infinity(), GISTSTATE::penaltyFn, PointerGetDatum, and GISTSTATE::supportCollation.
Referenced by findDontCares(), gistchoose(), gistRelocateBuildBuffersOnSplit(), placeOne(), and supportSecondarySplit().
bool gistplacetopage | ( | Relation | rel, |
Size | freespace, | ||
GISTSTATE * | giststate, | ||
Buffer | buffer, | ||
IndexTuple * | itup, | ||
int | ntup, | ||
OffsetNumber | oldoffnum, | ||
BlockNumber * | newblkno, | ||
Buffer | leftchildbuf, | ||
List ** | splitinfo, | ||
bool | markleftchild | ||
) |
Definition at line 215 of file gist.c.
References DataPageDeleteStack::blkno, gistxlogPage::blkno, SplitedPageLayout::block, GISTPageSplitInfo::buf, SplitedPageLayout::buffer, buffer, BufferGetBlockNumber(), BufferGetPage, BufferIsValid, GISTPageSplitInfo::downlink, elog, END_CRIT_SECTION, ERROR, F_LEAF, FirstOffsetNumber, GIST_MAX_SPLIT_PAGES, GIST_ROOT_BLKNO, GistClearFollowRight, gistextractpage(), gistfillbuffer(), gistfillitupvec(), GistFollowRight, gistGetFakeLSN(), GISTInitBuffer(), gistjoinvector(), GistMarkFollowRight, gistNewBuffer(), gistnospace(), GistPageGetNSN, GistPageGetOpaque, GistPageHasGarbage, GistPageIsLeaf, GistPageSetNSN, gistSplit(), GistTupleSetValid, gistvacuumpage(), gistXLogSplit(), gistXLogUpdate(), i, IndexTupleSize, InvalidBlockNumber, InvalidOffsetNumber, ItemPointerEquals(), ItemPointerSetBlockNumber, SplitedPageLayout::itup, lappend(), SplitedPageLayout::lenlist, SplitedPageLayout::list, MarkBufferDirty(), memmove, SplitedPageLayout::next, NIL, gistxlogPage::num, OffsetNumberIsValid, SplitedPageLayout::page, PageAddItem, PageGetTempPageCopySpecial(), PageIndexTupleDelete(), PageIndexTupleOverwrite(), PageRestoreTempPage(), PageSetLSN, palloc(), PredicateLockPageSplit(), RelationGetRelationName, RelationNeedsWAL, START_CRIT_SECTION, IndexTupleData::t_tid, UnlockReleaseBuffer(), and XLogEnsureRecordSpace().
Referenced by gistbufferinginserttuples(), and gistinserttuples().
bool gistPopItupFromNodeBuffer | ( | GISTBuildBuffers * | gfbb, |
GISTNodeBuffer * | nodeBuffer, | ||
IndexTuple * | item | ||
) |
Definition at line 410 of file gistbuildbuffers.c.
References Assert, GISTNodeBuffer::blocksCount, gistBuffersReleaseBlock(), gistGetItupFromPage(), gistLoadNodeBuffer(), InvalidBlockNumber, PAGE_IS_EMPTY, GISTNodeBuffer::pageBuffer, GISTBuildBuffers::pfile, pfree(), GISTNodeBufferPage::prev, and ReadTempFileBlock().
Referenced by gistProcessEmptyingQueue(), and gistRelocateBuildBuffersOnSplit().
bool gistproperty | ( | Oid | index_oid, |
int | attno, | ||
IndexAMProperty | prop, | ||
const char * | propname, | ||
bool * | res, | ||
bool * | isnull | ||
) |
Definition at line 871 of file gistutil.c.
References AMPROCNUM, AMPROP_DISTANCE_ORDERABLE, AMPROP_RETURNABLE, Assert, CLAOID, DatumGetPointer, GETSTRUCT, GIST_COMPRESS_PROC, GIST_DISTANCE_PROC, GIST_FETCH_PROC, HeapTupleIsValid, INDEXRELID, Int16GetDatum, ObjectIdGetDatum, PG_USED_FOR_ASSERTS_ONLY, ReleaseSysCache(), SearchSysCache1(), SearchSysCacheExists4, SysCacheGetAttr(), and oidvector::values.
Referenced by gisthandler().
void gistPushItupToNodeBuffer | ( | GISTBuildBuffers * | gfbb, |
GISTNodeBuffer * | nodeBuffer, | ||
IndexTuple | item | ||
) |
Definition at line 340 of file gistbuildbuffers.c.
References DataPageDeleteStack::blkno, GISTNodeBuffer::blocksCount, BUFFER_HALF_FILLED, GISTBuildBuffers::bufferEmptyingQueue, GISTBuildBuffers::context, gistAddLoadedBuffer(), gistAllocateNewPageBuffer(), gistBuffersGetFreeBlock(), gistLoadNodeBuffer(), gistPlaceItupToPage(), lcons(), MAXALIGN, MemoryContextSwitchTo(), offsetof, PAGE_FREE_SPACE, PAGE_NO_SPACE, GISTNodeBuffer::pageBuffer, GISTBuildBuffers::pfile, GISTNodeBufferPage::prev, GISTNodeBuffer::queuedForEmptying, and WriteTempFileBlock().
Referenced by gistProcessItup(), and gistRelocateBuildBuffersOnSplit().
void gistRelocateBuildBuffersOnSplit | ( | GISTBuildBuffers * | gfbb, |
GISTSTATE * | giststate, | ||
Relation | r, | ||
int | level, | ||
Buffer | buffer, | ||
List * | splitinfo | ||
) |
Definition at line 537 of file gistbuildbuffers.c.
References Assert, GISTNodeBuffer::blocksCount, GISTPageSplitInfo::buf, BufferGetBlockNumber(), GISTPageSplitInfo::downlink, RelocationBufferInfo::entry, GIST_ROOT_BLKNO, gistDeCompressAtt(), gistgetadjusted(), gistGetNodeBuffer(), gistpenalty(), gistPopItupFromNodeBuffer(), gistPushItupToNodeBuffer(), HASH_FIND, hash_search(), i, INDEX_MAX_KEYS, InvalidBlockNumber, RelocationBufferInfo::isnull, GISTNodeBuffer::isTemp, LEVEL_HAS_BUFFERS, lfirst, list_length(), tupleDesc::natts, RelocationBufferInfo::nodeBuffer, GISTBuildBuffers::nodeBuffersTab, GISTNodeBuffer::pageBlocknum, GISTNodeBuffer::pageBuffer, palloc(), pfree(), RelationData::rd_att, and RelocationBufferInfo::splitinfo.
Referenced by gistbufferinginserttuples().
SplitedPageLayout* gistSplit | ( | Relation | r, |
Page | page, | ||
IndexTuple * | itup, | ||
int | len, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 1351 of file gist.c.
References Assert, SplitedPageLayout::block, check_stack_depth(), ereport, errcode(), errmsg(), ERROR, gistfillitupvec(), gistfitpage(), gistFormTuple(), GiSTPageSize, gistSplit(), gistSplitByKey(), i, IndexTupleSize, SplitedPageLayout::itup, SplitedPageLayout::lenlist, SplitedPageLayout::list, tupleDesc::natts, SplitedPageLayout::next, gistxlogPage::num, palloc(), RelationGetRelationName, ROTATEDIST, GistSplitVector::spl_lattr, GIST_SPLITVEC::spl_left, GistSplitVector::spl_lisnull, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GistSplitVector::spl_rattr, GIST_SPLITVEC::spl_right, GistSplitVector::spl_risnull, GistSplitVector::splitVector, and GISTSTATE::tupdesc.
Referenced by gistplacetopage(), and gistSplit().
void gistSplitByKey | ( | Relation | r, |
Page | page, | ||
IndexTuple * | itup, | ||
int | len, | ||
GISTSTATE * | giststate, | ||
GistSplitVector * | v, | ||
int | attno | ||
) |
Definition at line 623 of file gistsplit.c.
References Assert, GEVHDRSZ, gistdentryinit(), gistSplitByKey(), gistSplitHalf(), gistunionsubkey(), gistUserPicksplit(), i, index_getattr, GistEntryVector::n, tupleDesc::natts, palloc(), GistSplitVector::spl_dontcare, GIST_SPLITVEC::spl_left, GistSplitVector::spl_lisnull, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_right, GistSplitVector::spl_risnull, GistSplitVector::splitVector, GISTSTATE::tupdesc, and GistEntryVector::vector.
Referenced by gistSplit(), and gistSplitByKey().
IndexTuple gistunion | ( | Relation | r, |
IndexTuple * | itvec, | ||
int | len, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 217 of file gistutil.c.
References gistFormTuple(), gistMakeUnionItVec(), and INDEX_MAX_KEYS.
void gistUnloadNodeBuffers | ( | GISTBuildBuffers * | gfbb | ) |
Definition at line 276 of file gistbuildbuffers.c.
References gistUnloadNodeBuffer(), i, GISTBuildBuffers::loadedBuffers, and GISTBuildBuffers::loadedBuffersCount.
Referenced by gistProcessEmptyingQueue().
IndexBulkDeleteResult* gistvacuumcleanup | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 29 of file gistvacuum.c.
References IndexVacuumInfo::analyze_only, DataPageDeleteStack::blkno, buffer, BufferGetPage, IndexBulkDeleteResult::estimated_count, ExclusiveLock, GIST_ROOT_BLKNO, GIST_SHARE, GistPageIsDeleted, GistPageIsLeaf, IndexVacuumInfo::index, IndexFreeSpaceMapVacuum(), LockBuffer(), LockRelationForExtension(), MAIN_FORKNUM, IndexBulkDeleteResult::num_index_tuples, IndexBulkDeleteResult::num_pages, PageGetMaxOffsetNumber, PageIsNew, IndexBulkDeleteResult::pages_free, palloc0(), RBM_NORMAL, ReadBufferExtended(), RecordFreeIndexPage(), RELATION_IS_LOCAL, RelationGetNumberOfBlocks, IndexVacuumInfo::strategy, UnlockRelationForExtension(), UnlockReleaseBuffer(), and vacuum_delay_point().
Referenced by gisthandler().
Definition at line 34 of file gistvalidate.c.
References AMOPSTRATEGY, AMPROCNUM, check_amop_signature(), check_amproc_signature(), CLAOID, elog, ereport, errcode(), errmsg(), ERROR, format_operator(), format_procedure(), OpFamilyOpFuncGroup::functionset, get_op_rettype(), get_opfamily_proc(), GETSTRUCT, GIST_COMPRESS_PROC, GIST_CONSISTENT_PROC, GIST_DECOMPRESS_PROC, GIST_DISTANCE_PROC, GIST_EQUAL_PROC, GIST_FETCH_PROC, GIST_PENALTY_PROC, GIST_PICKSPLIT_PROC, GIST_UNION_PROC, GISTNProcs, HeapTupleIsValid, i, identify_opfamily_groups(), INFO, OpFamilyOpFuncGroup::lefttype, lfirst, catclist::members, catclist::n_members, NameStr, ObjectIdGetDatum, OidIsValid, opfamily_can_sort_type(), OPFAMILYOID, ReleaseCatCacheList(), ReleaseSysCache(), OpFamilyOpFuncGroup::righttype, SearchSysCache1(), SearchSysCacheList1, and catctup::tuple.
Referenced by gisthandler().