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 "catalog/pg_opclass.h"
#include "storage/indexfsm.h"
#include "storage/lmgr.h"
#include "utils/float.h"
#include "utils/lsyscache.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Go to the source code of this file.
Definition at line 787 of file gistutil.c.
References BufferGetBlockNumber(), BufferGetPage, ereport, errcode(), errhint(), errmsg(), ERROR, MAXALIGN, GistSortedBuildPageState::page, 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, GISTSTATE::leafTupdesc, MAX_RANDOM_VALUE, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, and random().
Referenced by gistdoinsert(), and gistProcessItup().
void gistCompressValues | ( | GISTSTATE * | giststate, |
Relation | r, | ||
Datum * | attdata, | ||
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, OffsetNumberNext, PageGetItem, PageGetItemId, PageGetMaxOffsetNumber, and palloc().
Referenced by gist_indexsortbuild_pagestate_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, OffsetNumberNext, PageAddItem, PageGetMaxOffsetNumber, and PageIsEmpty.
Referenced by gist_indexsortbuild_pagestate_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 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 | ||
) |
Definition at line 574 of file gistutil.c.
References gistCompressValues(), index_form_tuple(), INDEX_MAX_KEYS, ItemPointerSetOffsetNumber, GISTSTATE::leafTupdesc, GISTSTATE::nonLeafTupdesc, and IndexTupleData::t_tid.
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 1027 of file gistutil.c.
References Assert, FirstNormalUnloggedLSN, GetFakeLSNForUnloggedRel(), GetXLogInsertRecPtr(), gistXLogAssignLSN(), InvalidXLogRecPtr, RelationData::rd_rel, RelationNeedsWAL, and XLogRecPtrIsInvalid.
Referenced by gistdeletepage(), gistplacetopage(), gistprunepage(), gistvacuumpage(), and gistvacuumscan().
Definition at line 775 of file gistutil.c.
References BufferGetPage, gistinitpage(), and GistSortedBuildPageState::page.
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_pagestate_flush(), and GISTInitBuffer().
IndexTuple* gistjoinvector | ( | IndexTuple * | itvec, |
int * | len, | ||
IndexTuple * | additvec, | ||
int | addlen | ||
) |
Definition at line 113 of file gistutil.c.
References repalloc().
Referenced by gistplacetopage().
Definition at line 280 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, GISTSTATE::leafTupdesc, 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, GISTSTATE::supportCollation, GISTSTATE::unionFn, and GistEntryVector::vector.
Referenced by gistgetadjusted(), and supportSecondarySplit().
Definition at line 826 of file gistutil.c.
References BufferGetPage, ConditionalLockBuffer(), ExclusiveLock, GetFreeIndexPage(), GIST_EXCLUSIVE, GIST_UNLOCK, gistcheckpage(), GistPageGetDeleteXid(), gistPageRecyclable(), gistXLogPageReuse(), InvalidBlockNumber, LockBuffer(), LockRelationForExtension(), P_NEW, GistSortedBuildPageState::page, PageIsNew, ReadBuffer(), RELATION_IS_LOCAL, RelationNeedsWAL, ReleaseBuffer(), UnlockRelationForExtension(), 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, PageGetFreeSpace(), PageGetItem, and PageGetItemId.
Referenced by gistplacetopage().
Definition at line 923 of file gistutil.c.
References build_reloptions(), fillfactor, lengthof, offsetof, RELOPT_KIND_GIST, RELOPT_TYPE_ENUM, and RELOPT_TYPE_INT.
Referenced by gisthandler().
Definition at line 899 of file gistutil.c.
References GistPageGetDeleteXid(), GistPageIsDeleted, GlobalVisIsRemovableFullXid(), 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 944 of file gistutil.c.
References AMPROCNUM, 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, 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(), and INDEX_MAX_KEYS.
Referenced by gist_indexsortbuild_pagestate_flush().