PostgreSQL Source Code
git master
|
#include "access/amapi.h"
#include "access/gist.h"
#include "access/itup.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 | SplitPageLayout |
struct | GISTInsertStack |
struct | GistSplitVector |
struct | GISTInsertState |
struct | GISTNodeBuffer |
struct | GISTBuildBuffers |
struct | GiSTOptions |
struct | GISTPageSplitInfo |
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 SplitPageLayout | SplitPageLayout |
typedef struct GISTInsertStack | GISTInsertStack |
typedef struct GistSplitVector | GistSplitVector |
typedef struct GISTBuildBuffers | GISTBuildBuffers |
typedef enum GistOptBufferingMode | GistOptBufferingMode |
typedef struct GiSTOptions | GiSTOptions |
Enumerations | |
enum | GistOptBufferingMode { GIST_OPTION_BUFFERING_AUTO , GIST_OPTION_BUFFERING_ON , GIST_OPTION_BUFFERING_OFF } |
#define BUFFER_HALF_FILLED | ( | nodeBuffer, | |
gfbb | |||
) | ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) |
Definition at line 324 of file gist_private.h.
#define BUFFER_OVERFLOWED | ( | nodeBuffer, | |
gfbb | |||
) | ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) |
Definition at line 332 of file gist_private.h.
#define BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) |
Definition at line 53 of file gist_private.h.
#define GIST_DEFAULT_FILLFACTOR 90 |
Definition at line 480 of file gist_private.h.
#define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE |
Definition at line 43 of file gist_private.h.
#define GIST_MAX_SPLIT_PAGES 75 |
Definition at line 39 of file gist_private.h.
#define GIST_MIN_FILLFACTOR 10 |
Definition at line 479 of file gist_private.h.
#define GIST_ROOT_BLKNO 0 |
Definition at line 262 of file gist_private.h.
#define GIST_SHARE BUFFER_LOCK_SHARE |
Definition at line 42 of file gist_private.h.
#define GIST_UNLOCK BUFFER_LOCK_UNLOCK |
Definition at line 44 of file gist_private.h.
#define GiSTPageSize ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) |
Definition at line 476 of file gist_private.h.
#define GISTSearchItemIsHeap | ( | item | ) | ((item).blkno == InvalidBlockNumber) |
Definition at line 145 of file gist_private.h.
#define GistTupleIsInvalid | ( | itup | ) | ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) |
Definition at line 288 of file gist_private.h.
#define GistTupleSetValid | ( | itup | ) | ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) |
Definition at line 289 of file gist_private.h.
#define LEVEL_HAS_BUFFERS | ( | nlevel, | |
gfbb | |||
) |
Definition at line 319 of file gist_private.h.
#define PAGE_FREE_SPACE | ( | nbp | ) | (nbp->freespace) |
Definition at line 55 of file gist_private.h.
#define PAGE_IS_EMPTY | ( | nbp | ) | (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) |
Definition at line 57 of file gist_private.h.
#define PAGE_NO_SPACE | ( | nbp, | |
itup | |||
) |
Definition at line 59 of file gist_private.h.
#define SizeOfGISTSearchItem | ( | n_distances | ) |
Definition at line 147 of file gist_private.h.
#define TUPLE_IS_INVALID 0xfffe |
Definition at line 286 of file gist_private.h.
#define TUPLE_IS_VALID 0xffff |
Definition at line 285 of file gist_private.h.
typedef struct GISTBuildBuffers GISTBuildBuffers |
typedef struct GISTInsertStack GISTInsertStack |
typedef enum GistOptBufferingMode GistOptBufferingMode |
typedef struct GiSTOptions GiSTOptions |
typedef GISTScanOpaqueData* GISTScanOpaque |
Definition at line 181 of file gist_private.h.
typedef struct GISTScanOpaqueData GISTScanOpaqueData |
typedef struct GISTSearchHeapItem GISTSearchHeapItem |
typedef struct GISTSearchItem GISTSearchItem |
typedef struct GistSplitVector GistSplitVector |
typedef struct gistxlogPage gistxlogPage |
typedef struct SplitPageLayout SplitPageLayout |
enum GistOptBufferingMode |
Enumerator | |
---|---|
GIST_OPTION_BUFFERING_AUTO | |
GIST_OPTION_BUFFERING_ON | |
GIST_OPTION_BUFFERING_OFF |
Definition at line 384 of file gist_private.h.
MemoryContext createTempGistContext | ( | void | ) |
Definition at line 123 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 1653 of file gist.c.
References MemoryContextDelete(), and GISTSTATE::scanCxt.
Referenced by gistbuild(), and gistendscan().
Definition at line 295 of file gistvalidate.c.
References ereport, errcode(), errmsg(), ERROR, functions, GIST_COMPRESS_PROC, GIST_CONSISTENT_PROC, GIST_DECOMPRESS_PROC, GIST_DISTANCE_PROC, GIST_EQUAL_PROC, GIST_FETCH_PROC, GIST_OPTIONS_PROC, GIST_PENALTY_PROC, GIST_PICKSPLIT_PROC, GIST_SORTSUPPORT_PROC, GIST_STRATNUM_PROC, GIST_UNION_PROC, lfirst, OpFamilyMember::number, OpFamilyMember::ref_is_family, OpFamilyMember::ref_is_hard, and OpFamilyMember::refobjid.
Referenced by gisthandler().
IndexBuildResult* gistbuild | ( | Relation | heap, |
Relation | index, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 179 of file gistbuild.c.
References Assert, BufferGetBlockNumber(), BufferGetPage(), GISTBuildState::buildMode, createTempGistContext(), CurrentMemoryContext, DEBUG1, elog, END_CRIT_SECTION, ERROR, F_LEAF, fillfactor, freeGISTstate(), GISTBuildState::freespace, GISTBuildState::gfbb, GIST_BUFFERING_ACTIVE, GIST_BUFFERING_AUTO, GIST_BUFFERING_DISABLED, GIST_BUFFERING_STATS, GIST_DEFAULT_FILLFACTOR, gist_indexsortbuild(), GIST_OPTION_BUFFERING_OFF, GIST_OPTION_BUFFERING_ON, GIST_ROOT_BLKNO, GIST_SORTED_BUILD, GIST_SORTSUPPORT_PROC, gistBuildCallback(), GistBuildLSN, gistEmptyAllBuffers(), gistFreeBuildBuffers(), GISTInitBuffer(), gistNewBuffer(), gistSortedBuildCallback(), GISTBuildState::giststate, IndexBuildResult::heap_tuples, GISTBuildState::heaprel, i, if(), index_getprocid(), INDEX_MAX_KEYS, IndexBuildResult::index_tuples, GISTBuildState::indexrel, IndexRelationGetNumberOfKeyAttributes, GISTBuildState::indtuples, GISTBuildState::indtuplesSize, initGISTstate(), log_newpage_range(), MAIN_FORKNUM, maintenance_work_mem, MarkBufferDirty(), MemoryContextDelete(), MemoryContextSwitchTo(), OidIsValid, PageSetLSN(), palloc(), RelationGetNumberOfBlocks, RelationGetRelationName, RelationNeedsWAL, GISTBuildState::sortstate, START_CRIT_SECTION, table_index_build_scan(), GISTSTATE::tempCxt, tuplesort_begin_index_gist(), tuplesort_end(), TUPLESORT_NONE, tuplesort_performsort(), and UnlockReleaseBuffer().
Referenced by gisthandler().
void gistbuildempty | ( | Relation | index | ) |
Definition at line 134 of file gist.c.
References BMR_REL, EB_LOCK_FIRST, EB_SKIP_EXTENSION_LOCK, END_CRIT_SECTION, ExtendBufferedRel(), F_LEAF, GISTInitBuffer(), INIT_FORKNUM, log_newpage_buffer(), MarkBufferDirty(), START_CRIT_SECTION, and UnlockReleaseBuffer().
Referenced by gisthandler().
IndexBulkDeleteResult* gistbulkdelete | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats, | ||
IndexBulkDeleteCallback | callback, | ||
void * | callback_state | ||
) |
Definition at line 59 of file gistvacuum.c.
References callback(), gistvacuumscan(), and palloc0().
Referenced by gisthandler().
bool gistcanreturn | ( | Relation | index, |
int | attno | ||
) |
Definition at line 793 of file gistget.c.
References GIST_COMPRESS_PROC, GIST_FETCH_PROC, index_getprocid(), IndexRelationGetNumberOfKeyAttributes, and OidIsValid.
Referenced by gisthandler().
Definition at line 785 of file gistutil.c.
References buf, BufferGetBlockNumber(), BufferGetPage(), ereport, errcode(), errhint(), errmsg(), ERROR, MAXALIGN, PageGetSpecialSize(), PageIsNew(), and RelationGetRelationName.
Referenced by gistBufferingFindCorrectParent(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistkillitems(), gistNewBuffer(), gistScanPage(), gistvacuum_delete_empty_pages(), and pgstat_gist_page().
OffsetNumber gistchoose | ( | Relation | r, |
Page | p, | ||
IndexTuple | it, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 374 of file gistutil.c.
References Assert, FirstOffsetNumber, gistDeCompressAtt(), gistdentryinit(), GistPageIsLeaf, gistpenalty(), i, index_getattr(), INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, j, GISTSTATE::leafTupdesc, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), pg_global_prng_state, and pg_prng_bool().
Referenced by gistdoinsert(), and gistProcessItup().
void gistCompressValues | ( | GISTSTATE * | giststate, |
Relation | r, | ||
const Datum * | attdata, | ||
const bool * | isnull, | ||
bool | isleaf, | ||
Datum * | compatt | ||
) |
Definition at line 596 of file gistutil.c.
References GISTSTATE::compressFn, DatumGetPointer(), FmgrInfo::fn_oid, FunctionCall1Coll(), gistentryinit, i, IndexRelationGetNumberOfKeyAttributes, GISTENTRY::key, TupleDescData::natts, OidIsValid, PointerGetDatum(), RelationData::rd_att, and GISTSTATE::supportCollation.
Referenced by gistFormTuple(), and gistSortedBuildCallback().
void gistDeCompressAtt | ( | GISTSTATE * | giststate, |
Relation | r, | ||
IndexTuple | tuple, | ||
Page | p, | ||
OffsetNumber | o, | ||
GISTENTRY * | attdata, | ||
bool * | isnull | ||
) |
Definition at line 296 of file gistutil.c.
References gistdentryinit(), i, index_getattr(), IndexRelationGetNumberOfKeyAttributes, and GISTSTATE::leafTupdesc.
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 547 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, | ||
Relation | heapRel, | ||
bool | is_build | ||
) |
Definition at line 634 of file gist.c.
References Assert, GISTInsertStack::blkno, GISTInsertStack::buffer, BufferGetLSNAtomic(), BufferGetPage(), GISTInsertStack::downlinkoffnum, ereport, errdetail(), errhint(), errmsg(), ERROR, GIST_EXCLUSIVE, GIST_ROOT_BLKNO, GIST_SHARE, GIST_UNLOCK, gistcheckpage(), gistchoose(), gistfixsplit(), GistFollowRight, gistgetadjusted(), gistinserttuple(), GistPageGetNSN, GistPageIsDeleted, GistPageIsLeaf, GistTupleIsInvalid, InvalidOffsetNumber, ItemPointerGetBlockNumber(), LockBuffer(), GISTInsertStack::lsn, GISTInsertStack::page, PageGetItem(), PageGetItemId(), PageGetLSN(), palloc0(), GISTInsertStack::parent, ReadBuffer(), RelationGetRelationName, RelationNeedsWAL, ReleaseBuffer(), GISTInsertStack::retry_from_parent, IndexTupleData::t_tid, UnlockReleaseBuffer(), and XLogRecPtrIsInvalid.
Referenced by gistBuildCallback(), and gistinsert().
IndexTuple* gistextractpage | ( | Page | page, |
int * | len | ||
) |
Definition at line 95 of file gistutil.c.
References FirstOffsetNumber, i, len, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and palloc().
Referenced by gist_indexsortbuild_levelstate_flush(), and gistplacetopage().
HeapTuple gistFetchTuple | ( | GISTSTATE * | giststate, |
Relation | r, | ||
IndexTuple | tuple | ||
) |
Definition at line 667 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, IndexRelationGetNumberOfKeyAttributes, InvalidOid, GISTSTATE::leafTupdesc, MemoryContextSwitchTo(), TupleDescData::natts, RelationData::rd_att, and GISTSTATE::tempCxt.
Referenced by gistScanPage().
void gistfillbuffer | ( | Page | page, |
IndexTuple * | itup, | ||
int | len, | ||
OffsetNumber | off | ||
) |
Definition at line 34 of file gistutil.c.
References elog, ERROR, FirstOffsetNumber, i, IndexTupleSize, InvalidOffsetNumber, len, OffsetNumberNext, PageAddItem, PageGetMaxOffsetNumber(), and PageIsEmpty().
Referenced by gist_indexsortbuild_levelstate_add(), gistplacetopage(), and gistRedoPageSplitRecord().
IndexTupleData* gistfillitupvec | ( | IndexTuple * | vec, |
int | veclen, | ||
int * | memlen | ||
) |
Definition at line 127 of file gistutil.c.
References i, IndexTupleSize, and palloc().
Referenced by gist_indexsortbuild_levelstate_flush(), gistplacetopage(), and gistSplit().
bool gistfitpage | ( | IndexTuple * | itvec, |
int | len | ||
) |
Definition at line 79 of file gistutil.c.
References GiSTPageSize, i, IndexTupleSize, len, and size.
Referenced by gistSplit().
IndexTuple gistFormTuple | ( | GISTSTATE * | giststate, |
Relation | r, | ||
const Datum * | attdata, | ||
const bool * | isnull, | ||
bool | isleaf | ||
) |
Definition at line 575 of file gistutil.c.
References gistCompressValues(), index_form_tuple(), INDEX_MAX_KEYS, ItemPointerSetOffsetNumber(), GISTSTATE::leafTupdesc, GISTSTATE::nonLeafTupdesc, and res.
Referenced by gistBuildCallback(), gistgetadjusted(), gistinsert(), gistSplit(), and gistunion().
void gistFreeBuildBuffers | ( | GISTBuildBuffers * | gfbb | ) |
Definition at line 507 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 316 of file gistutil.c.
References gistDeCompressAtt(), gistFormTuple(), gistKeyIsEQ(), gistMakeUnionKey(), i, INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, sort-test::key, and IndexTupleData::t_tid.
Referenced by gistdoinsert(), gistformdownlink(), gistProcessItup(), and gistRelocateBuildBuffersOnSplit().
int64 gistgetbitmap | ( | IndexScanDesc | scan, |
TIDBitmap * | tbm | ||
) |
Definition at line 743 of file gistget.c.
References CHECK_FOR_INTERRUPTS, GISTScanOpaqueData::curPageData, GISTSearchItem::distances, getNextGISTSearchItem(), GIST_ROOT_BLKNO, gistScanPage(), if(), 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 1016 of file gistutil.c.
References Assert, FirstNormalUnloggedLSN, GetFakeLSNForUnloggedRel(), GetXLogInsertRecPtr(), gistXLogAssignLSN(), InvalidXLogRecPtr, RelationData::rd_rel, RelationIsPermanent, RelationNeedsWAL, and XLogRecPtrIsInvalid.
Referenced by gistdeletepage(), gistplacetopage(), gistprunepage(), gistvacuumpage(), and gistvacuumscan().
GISTNodeBuffer* gistGetNodeBuffer | ( | GISTBuildBuffers * | gfbb, |
GISTSTATE * | giststate, | ||
BlockNumber | nodeBlocknum, | ||
int | level | ||
) |
Definition at line 113 of file gistbuildbuffers.c.
References GISTNodeBuffer::blocksCount, GISTBuildBuffers::buffersOnLevels, GISTBuildBuffers::buffersOnLevelsLen, GISTBuildBuffers::context, HASH_ENTER, hash_search(), i, InvalidBlockNumber, GISTNodeBuffer::isTemp, 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 612 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, if(), 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, IndexScanDescData::xs_heaptid, IndexScanDescData::xs_hitup, IndexScanDescData::xs_recheck, and IndexScanDescData::xs_want_itup.
Referenced by gisthandler().
Definition at line 773 of file gistutil.c.
References b, BufferGetPage(), and gistinitpage().
Referenced by gistbuild(), gistbuildempty(), gistplacetopage(), and gistRedoPageSplitRecord().
GISTBuildBuffers* gistInitBuildBuffers | ( | int | pagesPerBuffer, |
int | levelStep, | ||
int | maxLevel | ||
) |
Definition at line 44 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().
Definition at line 757 of file gistutil.c.
References GISTPageOpaqueData::flags, GISTPageOpaqueData::gist_page_id, GIST_PAGE_ID, GistPageGetOpaque, InvalidBlockNumber, PageInit(), and GISTPageOpaqueData::rightlink.
Referenced by gist_indexsortbuild(), gist_indexsortbuild_levelstate_add(), gist_indexsortbuild_levelstate_flush(), and GISTInitBuffer().
bool gistinsert | ( | Relation | r, |
Datum * | values, | ||
bool * | isnull, | ||
ItemPointer | ht_ctid, | ||
Relation | heapRel, | ||
IndexUniqueCheck | checkUnique, | ||
bool | indexUnchanged, | ||
struct IndexInfo * | indexInfo | ||
) |
Definition at line 160 of file gist.c.
References createTempGistContext(), gistdoinsert(), gistFormTuple(), if(), IndexInfo::ii_AmCache, IndexInfo::ii_Context, initGISTstate(), MemoryContextReset(), MemoryContextSwitchTo(), GISTSTATE::tempCxt, and values.
Referenced by gisthandler().
IndexTuple* gistjoinvector | ( | IndexTuple * | itvec, |
int * | len, | ||
IndexTuple * | additvec, | ||
int | addlen | ||
) |
Definition at line 114 of file gistutil.c.
References len, and repalloc().
Referenced by gist_indexsortbuild_levelstate_flush(), and gistplacetopage().
Definition at line 281 of file gistutil.c.
References a, b, 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 155 of file gistutil.c.
References FunctionCall2Coll(), GEVHDRSZ, gistdentryinit(), i, index_getattr(), j, GISTSTATE::leafTupdesc, len, GistEntryVector::n, TupleDescData::natts, GISTSTATE::nonLeafTupdesc, palloc(), PointerGetDatum(), GISTSTATE::supportCollation, 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 233 of file gistutil.c.
References FunctionCall2Coll(), GEVHDRSZ, GistEntryVector::n, PointerGetDatum(), storage, GISTSTATE::supportCollation, GISTSTATE::unionFn, and GistEntryVector::vector.
Referenced by gistgetadjusted(), and supportSecondarySplit().
Definition at line 824 of file gistutil.c.
References BMR_REL, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), GetFreeIndexPage(), GIST_UNLOCK, gistcheckpage(), GistPageGetDeleteXid(), gistPageRecyclable(), gistXLogPageReuse(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, PageIsNew(), ReadBuffer(), RelationNeedsWAL, ReleaseBuffer(), and XLogStandbyInfoActive.
Referenced by gistbuild(), and gistplacetopage().
bool gistnospace | ( | Page | page, |
IndexTuple * | itvec, | ||
int | len, | ||
OffsetNumber | todelete, | ||
Size | freespace | ||
) |
Definition at line 59 of file gistutil.c.
References i, IndexTupleSize, InvalidOffsetNumber, len, PageGetFreeSpace(), PageGetItem(), PageGetItemId(), and size.
Referenced by gistplacetopage().
Definition at line 912 of file gistutil.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_GIST, RELOPT_TYPE_ENUM, and RELOPT_TYPE_INT.
Referenced by gisthandler().
bool gistPageRecyclable | ( | Page | page | ) |
Definition at line 888 of file gistutil.c.
References GistPageGetDeleteXid(), GistPageIsDeleted, GlobalVisCheckRemovableFullXid(), and PageIsNew().
Referenced by gistNewBuffer(), and gistvacuumpage().
float gistpenalty | ( | GISTSTATE * | giststate, |
int | attno, | ||
GISTENTRY * | orig, | ||
bool | isNullOrig, | ||
GISTENTRY * | add, | ||
bool | isNullAdd | ||
) |
Definition at line 724 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 | markfollowright, | ||
Relation | heapRel, | ||
bool | is_build | ||
) |
Definition at line 225 of file gist.c.
References Assert, gistxlogPage::blkno, SplitPageLayout::block, GISTPageSplitInfo::buf, SplitPageLayout::buffer, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), data, GISTPageSplitInfo::downlink, elog, END_CRIT_SECTION, ERROR, F_LEAF, FirstOffsetNumber, GIST_MAX_SPLIT_PAGES, GIST_ROOT_BLKNO, GistBuildLSN, GistClearFollowRight, gistextractpage(), gistfillbuffer(), gistfillitupvec(), GistFollowRight, gistGetFakeLSN(), GISTInitBuffer(), gistjoinvector(), GistMarkFollowRight, gistNewBuffer(), gistnospace(), GistPageGetNSN, GistPageGetOpaque, GistPageHasGarbage, GistPageIsDeleted, GistPageIsLeaf, GistPageSetNSN, gistprunepage(), gistSplit(), GistTupleSetValid, gistXLogSplit(), gistXLogUpdate(), i, IndexTupleSize, InvalidBlockNumber, InvalidOffsetNumber, ItemPointerEquals(), ItemPointerSetBlockNumber(), SplitPageLayout::itup, lappend(), SplitPageLayout::lenlist, SplitPageLayout::list, MarkBufferDirty(), SplitPageLayout::next, NIL, gistxlogPage::num, OffsetNumberIsValid, SplitPageLayout::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 * | itup | ||
) |
Definition at line 406 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 933 of file gistutil.c.
References AMPROP_DISTANCE_ORDERABLE, AMPROP_RETURNABLE, get_index_column_opclass(), get_opclass_opfamily_and_input_type(), GIST_COMPRESS_PROC, GIST_DISTANCE_PROC, GIST_FETCH_PROC, Int16GetDatum(), ObjectIdGetDatum(), OidIsValid, res, and SearchSysCacheExists4.
Referenced by gisthandler().
void gistPushItupToNodeBuffer | ( | GISTBuildBuffers * | gfbb, |
GISTNodeBuffer * | nodeBuffer, | ||
IndexTuple | itup | ||
) |
Definition at line 336 of file gistbuildbuffers.c.
References GISTNodeBuffer::blocksCount, BUFFER_HALF_FILLED, GISTBuildBuffers::bufferEmptyingQueue, GISTBuildBuffers::context, gistAddLoadedBuffer(), gistAllocateNewPageBuffer(), gistBuffersGetFreeBlock(), gistLoadNodeBuffer(), gistPlaceItupToPage(), lcons(), MAXALIGN, MemoryContextSwitchTo(), 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 533 of file gistbuildbuffers.c.
References Assert, GISTNodeBuffer::blocksCount, GISTPageSplitInfo::buf, BufferGetBlockNumber(), GISTPageSplitInfo::downlink, RelocationBufferInfo::entry, foreach_current_index, GIST_ROOT_BLKNO, gistDeCompressAtt(), gistgetadjusted(), gistGetNodeBuffer(), gistpenalty(), gistPopItupFromNodeBuffer(), gistPushItupToNodeBuffer(), HASH_FIND, hash_search(), i, INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, InvalidBlockNumber, RelocationBufferInfo::isnull, GISTNodeBuffer::isTemp, j, LEVEL_HAS_BUFFERS, lfirst, list_length(), RelocationBufferInfo::nodeBuffer, GISTBuildBuffers::nodeBuffersTab, GISTNodeBuffer::pageBlocknum, GISTNodeBuffer::pageBuffer, palloc(), pfree(), and RelocationBufferInfo::splitinfo.
Referenced by gistbufferinginserttuples().
SplitPageLayout* gistSplit | ( | Relation | r, |
Page | page, | ||
IndexTuple * | itup, | ||
int | len, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 1438 of file gist.c.
References Assert, check_stack_depth(), ereport, errcode(), errmsg(), ERROR, for(), gistfillitupvec(), gistfitpage(), gistFormTuple(), GiSTPageSize, gistSplitByKey(), i, if(), IndexTupleSize, len, TupleDescData::natts, SplitPageLayout::next, GISTSTATE::nonLeafTupdesc, palloc(), RelationGetRelationName, res, 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, and GistSplitVector::splitVector.
Referenced by gist_indexsortbuild_levelstate_flush(), and gistplacetopage().
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, for(), GEVHDRSZ, gistdentryinit(), gistSplitHalf(), gistunionsubkey(), gistUserPicksplit(), i, index_getattr(), j, GISTSTATE::leafTupdesc, len, GistEntryVector::n, TupleDescData::natts, GISTSTATE::nonLeafTupdesc, 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, and GistEntryVector::vector.
Referenced by gistSplit().
IndexTuple gistunion | ( | Relation | r, |
IndexTuple * | itvec, | ||
int | len, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 219 of file gistutil.c.
References gistFormTuple(), gistMakeUnionItVec(), INDEX_MAX_KEYS, and len.
Referenced by gist_indexsortbuild_levelstate_flush().
void gistUnloadNodeBuffers | ( | GISTBuildBuffers * | gfbb | ) |
Definition at line 272 of file gistbuildbuffers.c.
References gistUnloadNodeBuffer(), i, GISTBuildBuffers::loadedBuffers, and GISTBuildBuffers::loadedBuffersCount.
Referenced by gistProcessEmptyingQueue().
IndexBulkDeleteResult* gistvacuumcleanup | ( | IndexVacuumInfo * | info, |
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 75 of file gistvacuum.c.
References IndexVacuumInfo::analyze_only, IndexVacuumInfo::estimated_count, gistvacuumscan(), IndexVacuumInfo::num_heap_tuples, IndexBulkDeleteResult::num_index_tuples, and palloc0().
Referenced by gisthandler().
bool gistvalidate | ( | Oid | opclassoid | ) |
Definition at line 33 of file gistvalidate.c.
References check_amop_signature(), check_amoptsproc_signature(), check_amproc_signature(), 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_OPTIONS_PROC, GIST_PENALTY_PROC, GIST_PICKSPLIT_PROC, GIST_SORTSUPPORT_PROC, GIST_STRATNUM_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(), ReleaseCatCacheList(), ReleaseSysCache(), OpFamilyOpFuncGroup::righttype, SearchSysCache1(), SearchSysCacheList1, and catctup::tuple.
Referenced by gisthandler().
XLogRecPtr gistXLogAssignLSN | ( | void | ) |
Definition at line 576 of file gistxlog.c.
References XLOG_GIST_ASSIGN_LSN, XLOG_MARK_UNIMPORTANT, XLogBeginInsert(), XLogInsert(), XLogRegisterData(), and XLogSetRecordFlags().
Referenced by gistGetFakeLSN().
XLogRecPtr gistXLogDelete | ( | Buffer | buffer, |
OffsetNumber * | todelete, | ||
int | ntodelete, | ||
TransactionId | snapshotConflictHorizon, | ||
Relation | heaprel | ||
) |
Definition at line 670 of file gistxlog.c.
References gistxlogDelete::isCatalogRel, gistxlogDelete::ntodelete, REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, SizeOfGistxlogDelete, gistxlogDelete::snapshotConflictHorizon, XLOG_GIST_DELETE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gistprunepage().
XLogRecPtr gistXLogPageDelete | ( | Buffer | buffer, |
FullTransactionId | xid, | ||
Buffer | parentBuffer, | ||
OffsetNumber | downlinkOffset | ||
) |
Definition at line 552 of file gistxlog.c.
References gistxlogPageDelete::deleteXid, gistxlogPageDelete::downlinkOffset, REGBUF_STANDARD, SizeOfGistxlogPageDelete, XLOG_GIST_PAGE_DELETE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gistdeletepage().
void gistXLogPageReuse | ( | Relation | rel, |
Relation | heaprel, | ||
BlockNumber | blkno, | ||
FullTransactionId | deleteXid | ||
) |
Definition at line 594 of file gistxlog.c.
References gistxlogPageReuse::block, gistxlogPageReuse::isCatalogRel, gistxlogPageReuse::locator, RelationData::rd_locator, RelationIsAccessibleInLogicalDecoding, SizeOfGistxlogPageReuse, gistxlogPageReuse::snapshotConflictHorizon, XLOG_GIST_PAGE_REUSE, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by gistNewBuffer().
XLogRecPtr gistXLogSplit | ( | bool | page_is_leaf, |
SplitPageLayout * | dist, | ||
BlockNumber | origrlink, | ||
GistNSN | orignsn, | ||
Buffer | leftchildbuf, | ||
bool | markfollowright | ||
) |
Definition at line 495 of file gistxlog.c.
References SplitPageLayout::block, SplitPageLayout::buffer, BufferIsValid(), i, SplitPageLayout::lenlist, SplitPageLayout::list, gistxlogPageSplit::markfollowright, SplitPageLayout::next, gistxlogPageSplit::npage, gistxlogPage::num, gistxlogPageSplit::origleaf, gistxlogPageSplit::orignsn, gistxlogPageSplit::origrlink, REGBUF_STANDARD, REGBUF_WILL_INIT, XLOG_GIST_PAGE_SPLIT, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gistplacetopage().
XLogRecPtr gistXLogUpdate | ( | Buffer | buffer, |
OffsetNumber * | todelete, | ||
int | ntodelete, | ||
IndexTuple * | itup, | ||
int | ituplen, | ||
Buffer | leftchildbuf | ||
) |
Definition at line 629 of file gistxlog.c.
References BufferIsValid(), i, IndexTupleSize, gistxlogPageUpdate::ntodelete, gistxlogPageUpdate::ntoinsert, REGBUF_STANDARD, XLOG_GIST_PAGE_UPDATE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gistplacetopage(), and gistvacuumpage().
Definition at line 1525 of file gist.c.