|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/gin_private.h"#include "access/ginxlog.h"#include "access/reloptions.h"#include "access/xloginsert.h"#include "catalog/pg_collation.h"#include "catalog/pg_type.h"#include "commands/progress.h"#include "commands/vacuum.h"#include "miscadmin.h"#include "storage/indexfsm.h"#include "utils/builtins.h"#include "utils/index_selfuncs.h"#include "utils/rel.h"#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
| struct | keyEntryData |
| struct | cmpEntriesArg |
Functions | |
| Datum | ginhandler (PG_FUNCTION_ARGS) |
| void | initGinState (GinState *state, Relation index) |
| OffsetNumber | gintuple_get_attrnum (GinState *ginstate, IndexTuple tuple) |
| Datum | gintuple_get_key (GinState *ginstate, IndexTuple tuple, GinNullCategory *category) |
| Buffer | GinNewBuffer (Relation index) |
| void | GinInitPage (Page page, uint32 f, Size pageSize) |
| void | GinInitBuffer (Buffer b, uint32 f) |
| void | GinInitMetabuffer (Buffer b) |
| static int | cmpEntries (const void *a, const void *b, void *arg) |
| Datum * | ginExtractEntries (GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories) |
| bytea * | ginoptions (Datum reloptions, bool validate) |
| void | ginGetStats (Relation index, GinStatsData *stats) |
| void | ginUpdateStats (Relation index, const GinStatsData *stats, bool is_build) |
| char * | ginbuildphasename (int64 phasenum) |
Definition at line 411 of file ginutil.c.
References a, arg, b, data, DatumGetInt32(), fb(), and FunctionCall2Coll().
Referenced by ginExtractEntries().
Definition at line 675 of file ginutil.c.
References fb(), PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE, PROGRESS_GIN_PHASE_INDEXBUILD_TABLESCAN, PROGRESS_GIN_PHASE_MERGE_1, PROGRESS_GIN_PHASE_MERGE_2, PROGRESS_GIN_PHASE_PERFORMSORT_1, and PROGRESS_GIN_PHASE_PERFORMSORT_2.
Referenced by ginhandler().
| Datum * ginExtractEntries | ( | GinState * | ginstate, |
| OffsetNumber | attnum, | ||
| Datum | value, | ||
| bool | isNull, | ||
| int32 * | nentries, | ||
| GinNullCategory ** | categories | ||
| ) |
Definition at line 451 of file ginutil.c.
References arg, attnum, cmpEntries(), GinState::compareFn, DatumGetPointer(), GinState::extractValueFn, fb(), FunctionCall3Coll(), GIN_CAT_EMPTY_ITEM, GIN_CAT_NORM_KEY, GIN_CAT_NULL_ITEM, GIN_CAT_NULL_KEY, i, j, palloc0(), palloc_array, palloc_object, pfree(), PointerGetDatum(), qsort_arg(), GinState::supportCollation, and value.
Referenced by ginHeapTupleBulkInsert(), ginHeapTupleFastCollect(), and ginHeapTupleInsert().
| void ginGetStats | ( | Relation | index, |
| GinStatsData * | stats | ||
| ) |
Definition at line 591 of file ginutil.c.
References BufferGetPage(), fb(), GIN_METAPAGE_BLKNO, GIN_SHARE, GinPageGetMeta, GinStatsData::ginVersion, GinMetaPageData::ginVersion, LockBuffer(), GinStatsData::nDataPages, GinMetaPageData::nDataPages, GinStatsData::nEntries, GinMetaPageData::nEntries, GinStatsData::nEntryPages, GinMetaPageData::nEntryPages, GinStatsData::nPendingPages, GinMetaPageData::nPendingPages, GinStatsData::nTotalPages, GinMetaPageData::nTotalPages, ReadBuffer(), and UnlockReleaseBuffer().
Referenced by gincostestimate(), and ginNewScanKey().
| Datum ginhandler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 38 of file ginutil.c.
References fb(), GIN_OPTIONS_PROC, ginadjustmembers(), ginbeginscan(), ginbuild(), ginbuildempty(), ginbuildphasename(), ginbulkdelete(), gincostestimate(), ginendscan(), gingetbitmap(), gininsert(), GINNProcs, ginoptions(), ginrescan(), ginvacuumcleanup(), ginvalidate(), InvalidOid, PG_RETURN_POINTER, IndexAmRoutine::type, VACUUM_OPTION_PARALLEL_BULKDEL, and VACUUM_OPTION_PARALLEL_CLEANUP.
Definition at line 356 of file ginutil.c.
References b, BufferGetPage(), BufferGetPageSize(), and GinInitPage().
Referenced by ginbuild(), ginbuildempty(), ginRedoCreatePTree(), ginRedoDeleteListPages(), ginRedoInsertListPage(), and writeListPage().
Definition at line 362 of file ginutil.c.
References b, BufferGetPage(), BufferGetPageSize(), GIN_CURRENT_VERSION, GIN_META, GinInitPage(), GinPageGetMeta, GinMetaPageData::ginVersion, GinMetaPageData::head, InvalidBlockNumber, GinMetaPageData::nDataPages, GinMetaPageData::nEntries, GinMetaPageData::nEntryPages, GinMetaPageData::nPendingHeapTuples, GinMetaPageData::nPendingPages, GinMetaPageData::nTotalPages, GinMetaPageData::tail, and GinMetaPageData::tailFreeSize.
Referenced by ginbuild(), ginbuildempty(), ginRedoDeleteListPages(), and ginRedoUpdateMetapage().
Definition at line 344 of file ginutil.c.
References fb(), GinPageOpaqueData::flags, GinPageGetOpaque, InvalidBlockNumber, PageInit(), and GinPageOpaqueData::rightlink.
Referenced by createPostingTree(), dataPlaceToPageLeafSplit(), dataSplitPageInternal(), entrySplitPage(), GinInitBuffer(), GinInitMetabuffer(), and ginPlaceToPage().
Definition at line 306 of file ginutil.c.
References BMR_REL, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), fb(), GetFreeIndexPage(), GIN_UNLOCK, GinPageIsRecyclable(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, ReadBuffer(), and ReleaseBuffer().
Referenced by createPostingTree(), ginbuild(), ginPlaceToPage(), and makeSublist().
Definition at line 570 of file ginutil.c.
References build_reloptions(), fb(), lengthof, RELOPT_KIND_GIN, RELOPT_TYPE_BOOL, RELOPT_TYPE_INT, and validate().
Referenced by ginhandler().
| OffsetNumber gintuple_get_attrnum | ( | GinState * | ginstate, |
| IndexTuple | tuple | ||
| ) |
Definition at line 232 of file ginutil.c.
References Assert, DatumGetUInt16(), fb(), FirstOffsetNumber, index_getattr(), GinState::oneCol, and GinState::tupdesc.
Referenced by addItemPointersToLeafTuple(), collectMatchBitmap(), collectMatchesForHeapRow(), entryIsMoveRight(), entryLocateEntry(), entryLocateLeafEntry(), gin_check_parent_keys_consistency(), gintuple_get_key(), ginVacuumEntryPage(), matchPartialInPendingList(), and processPendingPage().
| Datum gintuple_get_key | ( | GinState * | ginstate, |
| IndexTuple | tuple, | ||
| GinNullCategory * | category | ||
| ) |
Definition at line 265 of file ginutil.c.
References fb(), FirstOffsetNumber, GIN_CAT_NORM_KEY, GinGetNullCategory, gintuple_get_attrnum(), index_getattr(), OffsetNumberNext, GinState::oneCol, GinState::origTupdesc, and GinState::tupdesc.
Referenced by addItemPointersToLeafTuple(), collectMatchBitmap(), collectMatchesForHeapRow(), entryIsMoveRight(), entryLocateEntry(), entryLocateLeafEntry(), gin_check_parent_keys_consistency(), ginVacuumEntryPage(), matchPartialInPendingList(), and processPendingPage().
| void ginUpdateStats | ( | Relation | index, |
| const GinStatsData * | stats, | ||
| bool | is_build | ||
| ) |
Definition at line 618 of file ginutil.c.
References BufferGetPage(), data, END_CRIT_SECTION, fb(), GIN_EXCLUSIVE, GIN_METAPAGE_BLKNO, GinPageGetMeta, InvalidBlockNumber, ginxlogUpdateMeta::locator, LockBuffer(), MarkBufferDirty(), GinStatsData::nDataPages, GinMetaPageData::nDataPages, GinStatsData::nEntries, GinMetaPageData::nEntries, GinStatsData::nEntryPages, GinMetaPageData::nEntryPages, GinStatsData::nTotalPages, GinMetaPageData::nTotalPages, PageSetLSN(), ReadBuffer(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationNeedsWAL, START_CRIT_SECTION, UnlockReleaseBuffer(), XLOG_GIN_UPDATE_META_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by ginbuild(), and ginvacuumcleanup().
Definition at line 103 of file ginutil.c.
References TypeCacheEntry::cmp_proc_finfo, CreateTemplateTupleDesc(), CurrentMemoryContext, elog, ereport, errcode(), errmsg(), ERROR, fb(), fmgr_info_copy(), FmgrInfo::fn_oid, format_type_be(), GIN_COMPARE_PARTIAL_PROC, GIN_COMPARE_PROC, GIN_CONSISTENT_PROC, GIN_EXTRACTQUERY_PROC, GIN_EXTRACTVALUE_PROC, GIN_TRICONSISTENT_PROC, i, index_getprocid(), index_getprocinfo(), InvalidOid, lookup_type_cache(), MemSet, TupleDescData::natts, OidIsValid, RelationGetDescr, RelationGetRelationName, TupleDescAttr(), TupleDescInitEntry(), TupleDescInitEntryCollation(), and TYPECACHE_CMP_PROC_FINFO.
Referenced by _gin_parallel_build_main(), gin_check_parent_keys_consistency(), gin_clean_pending_list(), ginbeginscan(), ginbuild(), ginbulkdelete(), gininsert(), and ginvacuumcleanup().