PostgreSQL Source Code
git master
|
#include "access/itup.h"
#include "access/spgist.h"
#include "catalog/pg_am_d.h"
#include "nodes/tidbitmap.h"
#include "storage/buf.h"
#include "utils/geo_decls.h"
#include "utils/relcache.h"
Go to the source code of this file.
Data Structures | |
struct | SpGistOptions |
struct | SpGistPageOpaqueData |
struct | SpGistLastUsedPage |
struct | SpGistLUPCache |
struct | SpGistMetaPageData |
struct | SpGistTypeDesc |
struct | SpGistState |
struct | SpGistSearchItem |
struct | SpGistScanOpaqueData |
struct | SpGistCache |
struct | SpGistInnerTupleData |
struct | SpGistLeafTupleData |
struct | SpGistDeadTupleData |
Macros | |
#define | SpGistGetFillFactor(relation) |
#define | SpGistGetTargetPageFreeSpace(relation) (BLCKSZ * (100 - SpGistGetFillFactor(relation)) / 100) |
#define | spgKeyColumn 0 |
#define | spgFirstIncludeColumn 1 |
#define | SPGIST_METAPAGE_BLKNO (0) /* metapage */ |
#define | SPGIST_ROOT_BLKNO (1) /* root for normal entries */ |
#define | SPGIST_NULL_BLKNO (2) /* root for null-value entries */ |
#define | SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO |
#define | SpGistBlockIsRoot(blkno) ((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO) |
#define | SpGistBlockIsFixed(blkno) ((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO) |
#define | SPGIST_META (1<<0) |
#define | SPGIST_DELETED |
#define | SPGIST_LEAF (1<<2) |
#define | SPGIST_NULLS (1<<3) |
#define | SpGistPageGetOpaque(page) ((SpGistPageOpaque) PageGetSpecialPointer(page)) |
#define | SpGistPageIsMeta(page) (SpGistPageGetOpaque(page)->flags & SPGIST_META) |
#define | SpGistPageIsDeleted(page) (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED) |
#define | SpGistPageIsLeaf(page) (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF) |
#define | SpGistPageStoresNulls(page) (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS) |
#define | SPGIST_PAGE_ID 0xFF82 |
#define | SPGIST_CACHED_PAGES 8 |
#define | SPGIST_MAGIC_NUMBER (0xBA0BABEE) |
#define | SpGistPageGetMeta(p) ((SpGistMetaPageData *) PageGetContents(p)) |
#define | SizeOfSpGistSearchItem(n_distances) (offsetof(SpGistSearchItem, distances) + sizeof(double) * (n_distances)) |
#define | SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */ |
#define | SPGIST_REDIRECT 1 /* temporary redirection placeholder */ |
#define | SPGIST_DEAD 2 /* dead, cannot be removed because of links */ |
#define | SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */ |
#define | SGITMAXNNODES 0x1FFF |
#define | SGITMAXPREFIXSIZE 0xFFFF |
#define | SGITMAXSIZE 0xFFFF |
#define | SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData)) |
#define | _SGITDATA(x) (((char *) (x)) + SGITHDRSZ) |
#define | SGITDATAPTR(x) ((x)->prefixSize ? _SGITDATA(x) : NULL) |
#define | SGITDATUM(x, s) |
#define | SGITNODEPTR(x) ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize)) |
#define | SGITITERATE(x, i, nt) |
#define | SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData)) |
#define | SGNTDATAPTR(x) (((char *) (x)) + SGNTHDRSZ) |
#define | SGNTDATUM(x, s) |
#define | SGLT_GET_NEXTOFFSET(spgLeafTuple) ((spgLeafTuple)->t_info & 0x3FFF) |
#define | SGLT_GET_HASNULLMASK(spgLeafTuple) (((spgLeafTuple)->t_info & 0x8000) ? true : false) |
#define | SGLT_SET_NEXTOFFSET(spgLeafTuple, offsetNumber) |
#define | SGLT_SET_HASNULLMASK(spgLeafTuple, hasnulls) |
#define | SGLTHDRSZ(hasnulls) |
#define | SGLTDATAPTR(x) (((char *) (x)) + SGLTHDRSZ(SGLT_GET_HASNULLMASK(x))) |
#define | SGLTDATUM(x, s) |
#define | SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData)) |
#define | SPGIST_PAGE_CAPACITY |
#define | SpGistPageGetFreeSpace(p, n) |
#define | STORE_STATE(s, d) |
#define | GBUF_LEAF 0x03 |
#define | GBUF_INNER_PARITY(x) ((x) % 3) |
#define | GBUF_NULLS 0x04 |
#define | GBUF_PARITY_MASK 0x03 |
#define | GBUF_REQ_LEAF(flags) (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF) |
#define | GBUF_REQ_NULLS(flags) ((flags) & GBUF_NULLS) |
#define | SPGIST_MIN_FILLFACTOR 10 |
#define | SPGIST_DEFAULT_FILLFACTOR 80 |
Typedefs | |
typedef struct SpGistOptions | SpGistOptions |
typedef struct SpGistPageOpaqueData | SpGistPageOpaqueData |
typedef SpGistPageOpaqueData * | SpGistPageOpaque |
typedef struct SpGistLastUsedPage | SpGistLastUsedPage |
typedef struct SpGistLUPCache | SpGistLUPCache |
typedef struct SpGistMetaPageData | SpGistMetaPageData |
typedef struct SpGistLeafTupleData * | SpGistLeafTuple |
typedef struct SpGistTypeDesc | SpGistTypeDesc |
typedef struct SpGistState | SpGistState |
typedef struct SpGistSearchItem | SpGistSearchItem |
typedef struct SpGistScanOpaqueData | SpGistScanOpaqueData |
typedef SpGistScanOpaqueData * | SpGistScanOpaque |
typedef struct SpGistCache | SpGistCache |
typedef struct SpGistInnerTupleData | SpGistInnerTupleData |
typedef SpGistInnerTupleData * | SpGistInnerTuple |
typedef IndexTupleData | SpGistNodeTupleData |
typedef SpGistNodeTupleData * | SpGistNodeTuple |
typedef struct SpGistLeafTupleData | SpGistLeafTupleData |
typedef struct SpGistDeadTupleData | SpGistDeadTupleData |
typedef SpGistDeadTupleData * | SpGistDeadTuple |
Definition at line 311 of file spgist_private.h.
Definition at line 483 of file spgist_private.h.
#define GBUF_LEAF 0x03 |
Definition at line 482 of file spgist_private.h.
#define GBUF_NULLS 0x04 |
Definition at line 484 of file spgist_private.h.
#define GBUF_PARITY_MASK 0x03 |
Definition at line 486 of file spgist_private.h.
#define GBUF_REQ_LEAF | ( | flags | ) | (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF) |
Definition at line 487 of file spgist_private.h.
#define GBUF_REQ_NULLS | ( | flags | ) | ((flags) & GBUF_NULLS) |
Definition at line 488 of file spgist_private.h.
#define SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData)) |
Definition at line 437 of file spgist_private.h.
Definition at line 312 of file spgist_private.h.
#define SGITDATUM | ( | x, | |
s | |||
) |
Definition at line 313 of file spgist_private.h.
#define SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData)) |
Definition at line 310 of file spgist_private.h.
Definition at line 321 of file spgist_private.h.
#define SGITMAXNNODES 0x1FFF |
Definition at line 306 of file spgist_private.h.
#define SGITMAXPREFIXSIZE 0xFFFF |
Definition at line 307 of file spgist_private.h.
#define SGITMAXSIZE 0xFFFF |
Definition at line 308 of file spgist_private.h.
#define SGITNODEPTR | ( | x | ) | ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize)) |
Definition at line 318 of file spgist_private.h.
Definition at line 396 of file spgist_private.h.
#define SGLT_GET_NEXTOFFSET | ( | spgLeafTuple | ) | ((spgLeafTuple)->t_info & 0x3FFF) |
Definition at line 394 of file spgist_private.h.
#define SGLT_SET_HASNULLMASK | ( | spgLeafTuple, | |
hasnulls | |||
) |
Definition at line 401 of file spgist_private.h.
#define SGLT_SET_NEXTOFFSET | ( | spgLeafTuple, | |
offsetNumber | |||
) |
Definition at line 398 of file spgist_private.h.
#define SGLTDATAPTR | ( | x | ) | (((char *) (x)) + SGLTHDRSZ(SGLT_GET_HASNULLMASK(x))) |
Definition at line 409 of file spgist_private.h.
#define SGLTDATUM | ( | x, | |
s | |||
) |
Definition at line 410 of file spgist_private.h.
#define SGLTHDRSZ | ( | hasnulls | ) |
Definition at line 405 of file spgist_private.h.
Definition at line 340 of file spgist_private.h.
#define SGNTDATUM | ( | x, | |
s | |||
) |
Definition at line 341 of file spgist_private.h.
#define SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData)) |
Definition at line 339 of file spgist_private.h.
#define SizeOfSpGistSearchItem | ( | n_distances | ) | (offsetof(SpGistSearchItem, distances) + sizeof(double) * (n_distances)) |
Definition at line 182 of file spgist_private.h.
#define spgFirstIncludeColumn 1 |
Definition at line 44 of file spgist_private.h.
#define SPGIST_CACHED_PAGES 8 |
Definition at line 105 of file spgist_private.h.
#define SPGIST_DEAD 2 /* dead, cannot be removed because of links */ |
Definition at line 273 of file spgist_private.h.
#define SPGIST_DEFAULT_FILLFACTOR 80 |
Definition at line 494 of file spgist_private.h.
#define SPGIST_DELETED |
Definition at line 73 of file spgist_private.h.
#define SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO |
Definition at line 50 of file spgist_private.h.
#define SPGIST_LEAF (1<<2) |
Definition at line 74 of file spgist_private.h.
#define SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */ |
Definition at line 271 of file spgist_private.h.
#define SPGIST_MAGIC_NUMBER (0xBA0BABEE) |
Definition at line 121 of file spgist_private.h.
#define SPGIST_META (1<<0) |
Definition at line 72 of file spgist_private.h.
#define SPGIST_METAPAGE_BLKNO (0) /* metapage */ |
Definition at line 47 of file spgist_private.h.
#define SPGIST_MIN_FILLFACTOR 10 |
Definition at line 493 of file spgist_private.h.
Definition at line 49 of file spgist_private.h.
#define SPGIST_NULLS (1<<3) |
Definition at line 75 of file spgist_private.h.
#define SPGIST_PAGE_CAPACITY |
Definition at line 447 of file spgist_private.h.
#define SPGIST_PAGE_ID 0xFF82 |
Definition at line 91 of file spgist_private.h.
#define SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */ |
Definition at line 274 of file spgist_private.h.
#define SPGIST_REDIRECT 1 /* temporary redirection placeholder */ |
Definition at line 272 of file spgist_private.h.
Definition at line 48 of file spgist_private.h.
#define SpGistBlockIsFixed | ( | blkno | ) | ((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO) |
Definition at line 54 of file spgist_private.h.
#define SpGistBlockIsRoot | ( | blkno | ) | ((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO) |
Definition at line 52 of file spgist_private.h.
#define SpGistGetFillFactor | ( | relation | ) |
Definition at line 32 of file spgist_private.h.
#define SpGistGetTargetPageFreeSpace | ( | relation | ) | (BLCKSZ * (100 - SpGistGetFillFactor(relation)) / 100) |
Definition at line 38 of file spgist_private.h.
#define SpGistPageGetFreeSpace | ( | p, | |
n | |||
) |
Definition at line 456 of file spgist_private.h.
#define SpGistPageGetMeta | ( | p | ) | ((SpGistMetaPageData *) PageGetContents(p)) |
Definition at line 123 of file spgist_private.h.
#define SpGistPageGetOpaque | ( | page | ) | ((SpGistPageOpaque) PageGetSpecialPointer(page)) |
Definition at line 77 of file spgist_private.h.
#define SpGistPageIsDeleted | ( | page | ) | (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED) |
Definition at line 79 of file spgist_private.h.
#define SpGistPageIsLeaf | ( | page | ) | (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF) |
Definition at line 80 of file spgist_private.h.
#define SpGistPageIsMeta | ( | page | ) | (SpGistPageGetOpaque(page)->flags & SPGIST_META) |
Definition at line 78 of file spgist_private.h.
#define SpGistPageStoresNulls | ( | page | ) | (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS) |
Definition at line 81 of file spgist_private.h.
#define spgKeyColumn 0 |
Definition at line 43 of file spgist_private.h.
#define STORE_STATE | ( | s, | |
d | |||
) |
Definition at line 465 of file spgist_private.h.
typedef struct SpGistCache SpGistCache |
typedef SpGistDeadTupleData* SpGistDeadTuple |
Definition at line 435 of file spgist_private.h.
typedef struct SpGistDeadTupleData SpGistDeadTupleData |
typedef SpGistInnerTupleData* SpGistInnerTuple |
Definition at line 303 of file spgist_private.h.
typedef struct SpGistInnerTupleData SpGistInnerTupleData |
typedef struct SpGistLastUsedPage SpGistLastUsedPage |
typedef struct SpGistLeafTupleData* SpGistLeafTuple |
Definition at line 131 of file spgist_private.h.
typedef struct SpGistLeafTupleData SpGistLeafTupleData |
typedef struct SpGistLUPCache SpGistLUPCache |
typedef struct SpGistMetaPageData SpGistMetaPageData |
typedef SpGistNodeTupleData* SpGistNodeTuple |
Definition at line 337 of file spgist_private.h.
typedef IndexTupleData SpGistNodeTupleData |
Definition at line 335 of file spgist_private.h.
typedef struct SpGistOptions SpGistOptions |
typedef SpGistPageOpaqueData* SpGistPageOpaque |
Definition at line 69 of file spgist_private.h.
typedef struct SpGistPageOpaqueData SpGistPageOpaqueData |
typedef SpGistScanOpaqueData* SpGistScanOpaque |
Definition at line 244 of file spgist_private.h.
typedef struct SpGistScanOpaqueData SpGistScanOpaqueData |
typedef struct SpGistSearchItem SpGistSearchItem |
typedef struct SpGistState SpGistState |
typedef struct SpGistTypeDesc SpGistTypeDesc |
Definition at line 82 of file spgproc.c.
References palloc().
Referenced by spg_kd_inner_consistent(), and spg_quad_inner_consistent().
TupleDesc getSpGistTupleDesc | ( | Relation | index, |
SpGistTypeDesc * | keyType | ||
) |
Definition at line 310 of file spgutils.c.
References SpGistTypeDesc::attalign, SpGistTypeDesc::attbyval, SpGistTypeDesc::attlen, SpGistTypeDesc::attstorage, CreateTupleDescCopy(), i, InvalidCompressionMethod, InvalidOid, TupleDescData::natts, RelationGetDescr, spgFirstIncludeColumn, spgKeyColumn, TupleDescAttr, and SpGistTypeDesc::type.
Referenced by initSpGistState(), and spgbeginscan().
void initSpGistState | ( | SpGistState * | state, |
Relation | index | ||
) |
Definition at line 341 of file spgutils.c.
References SpGistCache::attLabelType, SpGistCache::attLeafType, SpGistCache::attPrefixType, SpGistCache::attType, SpGistCache::config, getSpGistTupleDesc(), GetTopTransactionIdIfAny(), palloc0(), SGDTSIZE, and spgGetCache().
Referenced by spgbeginscan(), spgbuild(), spginsert(), and spgvacuumscan().
Definition at line 63 of file spgproc.c.
References DatumGetBoxP(), DatumGetPointP(), sort-test::key, palloc(), point_box_distance(), point_point_distance, and ScanKeyData::sk_argument.
Referenced by spg_box_quad_leaf_consistent(), spg_kd_inner_consistent(), spg_quad_inner_consistent(), and spg_quad_leaf_consistent().
void spgDeformLeafTuple | ( | SpGistLeafTuple | tup, |
TupleDesc | tupleDescriptor, | ||
Datum * | datums, | ||
bool * | isnulls, | ||
bool | keyColumnIsNull | ||
) |
Definition at line 1108 of file spgutils.c.
References Assert, index_deform_tuple_internal(), TupleDescData::natts, SGLT_GET_HASNULLMASK, SGLTHDRSZ, and spgKeyColumn.
Referenced by doPickSplit(), and storeGettuple().
bool spgdoinsert | ( | Relation | index, |
SpGistState * | state, | ||
ItemPointer | heapPtr, | ||
Datum * | datums, | ||
bool * | isnulls | ||
) |
Definition at line 1914 of file spgdoinsert.c.
References addLeafTuple(), spgChooseOut::addNode, spgChooseIn::allTheSame, SpGistInnerTupleData::allTheSame, Assert, SPPageDesc::blkno, SPPageDesc::buffer, BUFFER_LOCK_EXCLUSIVE, BufferGetBlockNumber(), BufferGetPage(), CHECK_FOR_INTERRUPTS, checkSplitConditions(), ConditionalLockBuffer(), spgChooseIn::datum, doPickSplit(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, FirstOffsetNumber, FunctionCall1Coll(), FunctionCall2Coll(), GBUF_LEAF, GBUF_NULLS, spgChooseIn::hasPrefix, i, index_getprocid(), index_getprocinfo(), INDEX_MAX_KEYS, INTERRUPTS_CAN_BE_PROCESSED, INTERRUPTS_PENDING_CONDITION, InvalidBlockNumber, InvalidBuffer, InvalidOffsetNumber, spgChooseIn::leafDatum, spgChooseIn::level, LockBuffer(), spgChooseOut::matchNode, Min, moveLeafs(), TupleDescData::natts, spgChooseIn::nNodes, SpGistInnerTupleData::nNodes, SPPageDesc::node, spgChooseIn::nodeLabels, SPPageDesc::offnum, OidIsValid, SPPageDesc::page, PageGetItem(), PageGetItemId(), pfree(), PG_DETOAST_DATUM, pg_global_prng_state, pg_prng_uint64_range(), PointerGetDatum(), spgChooseIn::prefixDatum, SpGistInnerTupleData::prefixSize, ReadBuffer(), RelationGetRelationName, ReleaseBuffer(), spgChooseOut::result, spgChooseOut::resultType, SGITDATUM, SpGistLeafTupleData::size, spgAddNode, spgAddNodeAction(), spgExtractNodeLabels(), spgFirstIncludeColumn, spgFormLeafTuple(), SPGIST_CHOOSE_PROC, SPGIST_COMPRESS_PROC, SPGIST_NULL_BLKNO, SPGIST_PAGE_CAPACITY, SPGIST_ROOT_BLKNO, SpGistGetBuffer(), SpGistGetLeafTupleSize(), SpGistPageGetFreeSpace, SpGistPageIsLeaf, SpGistPageStoresNulls, SpGistSetLastUsedPage(), spgKeyColumn, spgMatchNode, spgMatchNodeAction(), spgSplitNodeAction(), spgSplitTuple, TupleDescAttr, and UnlockReleaseBuffer().
Referenced by spginsert(), and spgistBuildCallback().
Datum* spgExtractNodeLabels | ( | SpGistState * | state, |
SpGistInnerTuple | innerTuple | ||
) |
Definition at line 1153 of file spgutils.c.
References elog, ERROR, i, IndexTupleHasNulls, SpGistInnerTupleData::nNodes, palloc(), SGITITERATE, SGITNODEPTR, and SGNTDATUM.
Referenced by spgdoinsert(), and spgInitInnerConsistentIn().
SpGistDeadTuple spgFormDeadTuple | ( | SpGistState * | state, |
int | tupstate, | ||
BlockNumber | blkno, | ||
OffsetNumber | offnum | ||
) |
Definition at line 1078 of file spgutils.c.
References InvalidOffsetNumber, InvalidTransactionId, ItemPointerSet(), ItemPointerSetInvalid(), SpGistDeadTupleData::pointer, SGDTSIZE, SGLT_SET_NEXTOFFSET, SpGistDeadTupleData::size, SPGIST_REDIRECT, SpGistDeadTupleData::tupstate, and SpGistDeadTupleData::xid.
Referenced by spgAddNodeAction(), spgPageIndexMultiDelete(), and spgRedoAddNode().
SpGistInnerTuple spgFormInnerTuple | ( | SpGistState * | state, |
bool | hasPrefix, | ||
Datum | prefix, | ||
int | nNodes, | ||
SpGistNodeTuple * | nodes | ||
) |
Definition at line 995 of file spgutils.c.
References elog, ereport, errcode(), errhint(), errmsg(), ERROR, i, IndexTupleSize, memcpyInnerDatum(), SpGistInnerTupleData::nNodes, palloc0(), SpGistInnerTupleData::prefixSize, SGDTSIZE, SGITDATAPTR, SGITHDRSZ, SGITMAXNNODES, SGITMAXPREFIXSIZE, SGITMAXSIZE, SGITNODEPTR, size, SpGistInnerTupleData::size, SPGIST_PAGE_CAPACITY, and SpGistGetInnerTypeSize().
Referenced by addNode(), doPickSplit(), and spgSplitNodeAction().
SpGistLeafTuple spgFormLeafTuple | ( | SpGistState * | state, |
ItemPointer | heapPtr, | ||
const Datum * | datums, | ||
const bool * | isnulls | ||
) |
Definition at line 864 of file spgutils.c.
References heap_compute_data_size(), heap_fill_tuple(), SpGistLeafTupleData::heapPtr, i, InvalidOffsetNumber, MAXALIGN, TupleDescData::natts, palloc0(), SGDTSIZE, SGLT_SET_HASNULLMASK, SGLT_SET_NEXTOFFSET, SGLTHDRSZ, size, SpGistLeafTupleData::size, and spgKeyColumn.
Referenced by doPickSplit(), and spgdoinsert().
SpGistNodeTuple spgFormNodeTuple | ( | SpGistState * | state, |
Datum | label, | ||
bool | isnull | ||
) |
Definition at line 953 of file spgutils.c.
References ereport, errcode(), errmsg(), ERROR, INDEX_NULL_MASK, INDEX_SIZE_MASK, ItemPointerSetInvalid(), label, memcpyInnerDatum(), palloc0(), SGNTDATAPTR, SGNTHDRSZ, size, SpGistGetInnerTypeSize(), IndexTupleData::t_info, and IndexTupleData::t_tid.
Referenced by addNode(), doPickSplit(), and spgSplitNodeAction().
SpGistCache* spgGetCache | ( | Relation | index | ) |
Definition at line 183 of file spgutils.c.
References Assert, SpGistCache::attLabelType, SpGistCache::attLeafType, SpGistCache::attPrefixType, spgConfigIn::attType, SpGistCache::attType, BUFFER_LOCK_SHARE, BufferGetPage(), SpGistCache::config, elog, ereport, errcode(), errmsg(), ERROR, fillTypeDesc(), FunctionCall2Coll(), GetIndexInputType(), index_getprocid(), index_getprocinfo(), INDEX_MAX_KEYS, IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, IsBinaryCoercible(), spgConfigOut::labelType, SpGistMetaPageData::lastUsedPages, SpGistCache::lastUsedPages, spgConfigOut::leafType, LockBuffer(), SpGistMetaPageData::magicNumber, MemoryContextAllocZero(), OidIsValid, PointerGetDatum(), spgConfigOut::prefixType, ReadBuffer(), RelationGetDescr, RelationGetRelationName, SPGIST_COMPRESS_PROC, SPGIST_CONFIG_PROC, SPGIST_MAGIC_NUMBER, SPGIST_METAPAGE_BLKNO, SpGistPageGetMeta, spgKeyColumn, TupleDescAttr, and UnlockReleaseBuffer().
Referenced by allocNewBuffer(), initSpGistState(), spgcanreturn(), SpGistGetBuffer(), and SpGistSetLastUsedPage().
Definition at line 562 of file spgutils.c.
References allocNewBuffer(), Assert, SpGistLastUsedPage::blkno, BufferGetPage(), ConditionalLockBuffer(), elog, ERROR, SpGistLastUsedPage::freeSpace, GBUF_REQ_LEAF, GBUF_REQ_NULLS, GET_LUP, InvalidBlockNumber, Min, PageGetExactFreeSpace(), PageIsEmpty(), PageIsNew(), ReadBuffer(), ReleaseBuffer(), spgGetCache(), SPGIST_LEAF, SPGIST_NULLS, SPGIST_PAGE_CAPACITY, SpGistBlockIsFixed, SpGistGetTargetPageFreeSpace, SpGistInitBuffer(), SpGistPageIsDeleted, SpGistPageIsLeaf, SpGistPageStoresNulls, and UnlockReleaseBuffer().
Referenced by doPickSplit(), moveLeafs(), spgAddNodeAction(), spgdoinsert(), and spgSplitNodeAction().
unsigned int SpGistGetInnerTypeSize | ( | SpGistTypeDesc * | att, |
Datum | datum | ||
) |
Definition at line 772 of file spgutils.c.
References SpGistTypeDesc::attbyval, SpGistTypeDesc::attlen, MAXALIGN, size, and VARSIZE_ANY.
Referenced by spgFormInnerTuple(), and spgFormNodeTuple().
Size SpGistGetLeafTupleSize | ( | TupleDesc | tupleDescriptor, |
const Datum * | datums, | ||
const bool * | isnulls | ||
) |
Definition at line 811 of file spgutils.c.
References heap_compute_data_size(), i, MAXALIGN, TupleDescData::natts, SGDTSIZE, SGLTHDRSZ, and size.
Referenced by spgdoinsert().
Definition at line 715 of file spgutils.c.
References Assert, b, BufferGetPage(), BufferGetPageSize(), and SpGistInitPage().
Referenced by allocNewBuffer(), doPickSplit(), spgbuild(), SpGistGetBuffer(), spgRedoAddLeaf(), spgRedoAddNode(), spgRedoMoveLeafs(), spgRedoPickSplit(), and spgRedoSplitTuple().
void SpGistInitMetapage | ( | Page | page | ) |
Definition at line 725 of file spgutils.c.
References SpGistLastUsedPage::blkno, SpGistLUPCache::cachedPage, i, InvalidBlockNumber, SpGistMetaPageData::lastUsedPages, SpGistMetaPageData::magicNumber, SPGIST_CACHED_PAGES, SPGIST_MAGIC_NUMBER, SPGIST_META, SpGistInitPage(), and SpGistPageGetMeta.
Referenced by spgbuild(), and spgbuildempty().
Definition at line 701 of file spgutils.c.
References SpGistPageOpaqueData::flags, PageInit(), SpGistPageOpaqueData::spgist_page_id, SPGIST_PAGE_ID, and SpGistPageGetOpaque.
Referenced by spgbuildempty(), SpGistInitBuffer(), and SpGistInitMetapage().
Definition at line 387 of file spgutils.c.
References BMR_REL, BUFFER_LOCK_UNLOCK, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), GetFreeIndexPage(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, PageIsEmpty(), PageIsNew(), ReadBuffer(), ReleaseBuffer(), SpGistBlockIsFixed, and SpGistPageIsDeleted.
Referenced by allocNewBuffer(), and spgbuild().
OffsetNumber SpGistPageAddNewItem | ( | SpGistState * | state, |
Page | page, | ||
Item | item, | ||
Size | size, | ||
OffsetNumber * | startOffset, | ||
bool | errorOK | ||
) |
Definition at line 1196 of file spgutils.c.
References Assert, elog, ERROR, FirstOffsetNumber, i, InvalidOffsetNumber, MAXALIGN, SpGistPageOpaqueData::nPlaceholder, PageAddItem, PageGetExactFreeSpace(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageIndexTupleDelete(), PANIC, SGDTSIZE, size, SPGIST_PLACEHOLDER, SpGistPageGetOpaque, and SpGistDeadTupleData::tupstate.
Referenced by addLeafTuple(), doPickSplit(), moveLeafs(), spgAddNodeAction(), and spgSplitNodeAction().
Definition at line 666 of file spgutils.c.
References SpGistLastUsedPage::blkno, BufferGetBlockNumber(), BufferGetPage(), SpGistLastUsedPage::freeSpace, GBUF_INNER_PARITY, GBUF_LEAF, GBUF_NULLS, GET_LUP, InvalidBlockNumber, PageGetExactFreeSpace(), spgGetCache(), SpGistBlockIsFixed, SpGistPageIsLeaf, and SpGistPageStoresNulls.
Referenced by doPickSplit(), moveLeafs(), spgAddNodeAction(), spgdoinsert(), spgMatchNodeAction(), spgprocesspending(), spgSplitNodeAction(), and spgvacuumpage().
void SpGistUpdateMetaPage | ( | Relation | index | ) |
Definition at line 443 of file spgutils.c.
References BufferGetPage(), ConditionalLockBuffer(), if(), SpGistMetaPageData::lastUsedPages, SpGistCache::lastUsedPages, MarkBufferDirty(), ReadBuffer(), ReleaseBuffer(), SPGIST_METAPAGE_BLKNO, SpGistPageGetMeta, and UnlockReleaseBuffer().
Referenced by spgbuild(), spginsert(), and spgvacuumscan().
void spgPageIndexMultiDelete | ( | SpGistState * | state, |
Page | page, | ||
OffsetNumber * | itemnos, | ||
int | nitems, | ||
int | firststate, | ||
int | reststate, | ||
BlockNumber | blkno, | ||
OffsetNumber | offnum | ||
) |
Definition at line 131 of file spgdoinsert.c.
References cmpOffsetNumbers(), elog, ERROR, i, MaxIndexTuplesPerPage, nitems, PageAddItem, PageIndexMultiDelete(), qsort, SpGistDeadTupleData::size, spgFormDeadTuple(), SPGIST_PLACEHOLDER, SPGIST_REDIRECT, SpGistPageGetOpaque, and SpGistDeadTupleData::tupstate.
Referenced by doPickSplit(), moveLeafs(), spgRedoMoveLeafs(), spgRedoPickSplit(), spgRedoVacuumLeaf(), and vacuumLeafPage().
bool spgproperty | ( | Oid | index_oid, |
int | attno, | ||
IndexAMProperty | prop, | ||
const char * | propname, | ||
bool * | res, | ||
bool * | isnull | ||
) |
Definition at line 1291 of file spgutils.c.
References AMPROP_DISTANCE_ORDERABLE, get_index_column_opclass(), get_op_rettype(), get_opclass_opfamily_and_input_type(), GETSTRUCT, i, catclist::members, catclist::n_members, ObjectIdGetDatum(), OidIsValid, opfamily_can_sort_type(), ReleaseSysCacheList, res, SearchSysCacheList1, and catctup::tuple.
Referenced by spghandler().
void spgUpdateNodeLink | ( | SpGistInnerTuple | tup, |
int | nodeN, | ||
BlockNumber | blkno, | ||
OffsetNumber | offset | ||
) |
Definition at line 52 of file spgdoinsert.c.
References elog, ERROR, i, ItemPointerSet(), SGITITERATE, and IndexTupleData::t_tid.
Referenced by saveNodeLink(), spgRedoAddLeaf(), spgRedoAddNode(), spgRedoMoveLeafs(), spgRedoPickSplit(), and spgSplitNodeAction().