PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "access/gist_private.h"
#include "access/htup_details.h"
#include "access/reloptions.h"
#include "common/pg_prng.h"
#include "storage/indexfsm.h"
#include "utils/float.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Go to the source code of this file.
Definition at line 784 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 373 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 595 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 295 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 546 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().
IndexTuple* gistextractpage | ( | Page | page, |
int * | len | ||
) |
Definition at line 94 of file gistutil.c.
References FirstOffsetNumber, i, len, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and palloc().
Referenced by gist_indexsortbuild_levelstate_flush(), and gistplacetopage().
Definition at line 645 of file gistutil.c.
References DatumGetPointer(), GISTSTATE::fetchFn, FunctionCall1Coll(), gistentryinit, GISTENTRY::key, PointerGetDatum(), and GISTSTATE::supportCollation.
Referenced by gistFetchTuple().
HeapTuple gistFetchTuple | ( | GISTSTATE * | giststate, |
Relation | r, | ||
IndexTuple | tuple | ||
) |
Definition at line 666 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 33 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 126 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 78 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 574 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().
IndexTuple gistgetadjusted | ( | Relation | r, |
IndexTuple | oldtup, | ||
IndexTuple | addtup, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 315 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().
XLogRecPtr gistGetFakeLSN | ( | Relation | rel | ) |
Definition at line 1015 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().
Definition at line 772 of file gistutil.c.
References b, BufferGetPage(), and gistinitpage().
Referenced by gistbuild(), gistbuildempty(), gistplacetopage(), and gistRedoPageSplitRecord().
Definition at line 756 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().
IndexTuple* gistjoinvector | ( | IndexTuple * | itvec, |
int * | len, | ||
IndexTuple * | additvec, | ||
int | addlen | ||
) |
Definition at line 113 of file gistutil.c.
References len, and repalloc().
Referenced by gist_indexsortbuild_levelstate_flush(), and gistplacetopage().
Definition at line 280 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 154 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 232 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 823 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 58 of file gistutil.c.
References i, IndexTupleSize, InvalidOffsetNumber, len, PageGetFreeSpace(), PageGetItem(), PageGetItemId(), and size.
Referenced by gistplacetopage().
Definition at line 911 of file gistutil.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_GIST, RELOPT_TYPE_ENUM, and RELOPT_TYPE_INT.
Referenced by gisthandler().
Definition at line 887 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 723 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 gistproperty | ( | Oid | index_oid, |
int | attno, | ||
IndexAMProperty | prop, | ||
const char * | propname, | ||
bool * | res, | ||
bool * | isnull | ||
) |
Definition at line 932 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().
IndexTuple gistunion | ( | Relation | r, |
IndexTuple * | itvec, | ||
int | len, | ||
GISTSTATE * | giststate | ||
) |
Definition at line 218 of file gistutil.c.
References gistFormTuple(), gistMakeUnionItVec(), INDEX_MAX_KEYS, and len.
Referenced by gist_indexsortbuild_levelstate_flush().