PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/gin_private.h"
#include "access/ginxlog.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "catalog/pg_am.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "port/pg_bitutils.h"
#include "postmaster/autovacuum.h"
#include "storage/indexfsm.h"
#include "storage/lmgr.h"
#include "storage/predicate.h"
#include "utils/acl.h"
#include "utils/fmgrprotos.h"
#include "utils/memutils.h"
#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
struct | KeyArray |
Macros | |
#define | GIN_PAGE_FREESIZE ( BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(GinPageOpaqueData)) ) |
Typedefs | |
typedef struct KeyArray | KeyArray |
Functions | |
static int32 | writeListPage (Relation index, Buffer buffer, IndexTuple *tuples, int32 ntuples, BlockNumber rightlink) |
static void | makeSublist (Relation index, IndexTuple *tuples, int32 ntuples, GinMetaPageData *res) |
void | ginHeapTupleFastInsert (GinState *ginstate, GinTupleCollector *collector) |
void | ginHeapTupleFastCollect (GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid) |
static void | shiftList (Relation index, Buffer metabuffer, BlockNumber newHead, bool fill_fsm, IndexBulkDeleteResult *stats) |
static void | initKeyArray (KeyArray *keys, int32 maxvalues) |
static void | addDatum (KeyArray *keys, Datum datum, GinNullCategory category) |
static void | processPendingPage (BuildAccumulator *accum, KeyArray *ka, Page page, OffsetNumber startoff) |
void | ginInsertCleanup (GinState *ginstate, bool full_clean, bool fill_fsm, bool forceCleanup, IndexBulkDeleteResult *stats) |
Datum | gin_clean_pending_list (PG_FUNCTION_ARGS) |
Variables | |
int | gin_pending_list_limit = 0 |
#define GIN_PAGE_FREESIZE ( BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(GinPageOpaqueData)) ) |
|
static |
Definition at line 685 of file ginfast.c.
References KeyArray::categories, KeyArray::keys, KeyArray::maxvalues, KeyArray::nvalues, and repalloc_array.
Referenced by processPendingPage().
Datum gin_clean_pending_list | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1031 of file ginfast.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, DEBUG1, ereport, errcode(), errhint(), errmsg(), ERROR, GetUserId(), ginInsertCleanup(), index_close(), index_open(), initGinState(), OBJECT_INDEX, object_ownercheck(), IndexBulkDeleteResult::pages_deleted, PG_GETARG_OID, PG_RETURN_INT64, RelationData::rd_index, RelationData::rd_rel, RecoveryInProgress(), RELATION_IS_OTHER_TEMP, RelationGetRelationName, and RowExclusiveLock.
void ginHeapTupleFastCollect | ( | GinState * | ginstate, |
GinTupleCollector * | collector, | ||
OffsetNumber | attnum, | ||
Datum | value, | ||
bool | isNull, | ||
ItemPointer | ht_ctid | ||
) |
Definition at line 483 of file ginfast.c.
References attnum, elog, ERROR, ginExtractEntries(), GinFormTuple(), i, IndexTupleSize, GinTupleCollector::lentuples, Max, MaxAllocSize, GinTupleCollector::ntuples, palloc_array, pg_nextpower2_32(), repalloc_array, GinTupleCollector::sumsize, IndexTupleData::t_tid, GinTupleCollector::tuples, and value.
Referenced by gininsert().
void ginHeapTupleFastInsert | ( | GinState * | ginstate, |
GinTupleCollector * | collector | ||
) |
Definition at line 219 of file ginfast.c.
References Assert, BufferGetPage(), CheckForSerializableConflictIn(), data, elog, END_CRIT_SECTION, ERROR, FirstOffsetNumber, GIN_EXCLUSIVE, GIN_METAPAGE_BLKNO, GIN_PAGE_FREESIZE, GIN_UNLOCK, GinGetPendingListCleanupSize, ginInsertCleanup(), GinListPageSize, GinPageGetMeta, GinPageGetOpaque, GinMetaPageData::head, i, GinState::index, IndexTupleSize, InvalidBlockNumber, InvalidBuffer, InvalidOffsetNumber, LockBuffer(), makeSublist(), MarkBufferDirty(), GinMetaPageData::nPendingHeapTuples, GinMetaPageData::nPendingPages, GinTupleCollector::ntuples, OffsetNumberNext, PageAddItem, PageGetExactFreeSpace(), PageGetMaxOffsetNumber(), PageIsEmpty(), PageSetLSN(), palloc(), ReadBuffer(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetRelationName, RelationNeedsWAL, START_CRIT_SECTION, GinTupleCollector::sumsize, GinMetaPageData::tail, GinMetaPageData::tailFreeSize, GinTupleCollector::tuples, UnlockReleaseBuffer(), XLOG_GIN_UPDATE_META_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by gininsert().
void ginInsertCleanup | ( | GinState * | ginstate, |
bool | full_clean, | ||
bool | fill_fsm, | ||
bool | forceCleanup, | ||
IndexBulkDeleteResult * | stats | ||
) |
Definition at line 780 of file ginfast.c.
References BuildAccumulator::allocatedMemory, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, AmAutoVacuumWorkerProcess, Assert, attnum, autovacuum_work_mem, BufferGetPage(), ConditionalLockPage(), CurrentMemoryContext, ExclusiveLock, FirstOffsetNumber, GIN_EXCLUSIVE, GIN_METAPAGE_BLKNO, GIN_SHARE, GIN_UNLOCK, ginBeginBAScan(), ginEntryInsert(), ginGetBAEntry(), ginInitBA(), GinPageGetMeta, GinPageGetOpaque, GinPageHasFullRow, GinPageIsDeleted, BuildAccumulator::ginstate, GinMetaPageData::head, GinState::index, IndexFreeSpaceMapVacuum(), initKeyArray(), InvalidBlockNumber, sort-test::key, sort-test::list, LockBuffer(), LockPage(), maintenance_work_mem, KeyArray::maxvalues, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), opCtx, PageGetMaxOffsetNumber(), processPendingPage(), ReadBuffer(), ReleaseBuffer(), shiftList(), GinMetaPageData::tail, UnlockPage(), UnlockReleaseBuffer(), vacuum_delay_point(), and work_mem.
Referenced by gin_clean_pending_list(), ginbulkdelete(), ginHeapTupleFastInsert(), and ginvacuumcleanup().
Definition at line 675 of file ginfast.c.
References KeyArray::categories, KeyArray::keys, KeyArray::maxvalues, KeyArray::nvalues, and palloc_array.
Referenced by ginInsertCleanup().
|
static |
Definition at line 145 of file ginfast.c.
References Assert, BufferGetBlockNumber(), GinListPageSize, GinNewBuffer(), i, IndexTupleSize, InvalidBlockNumber, InvalidBuffer, MAXALIGN, res, size, and writeListPage().
Referenced by ginHeapTupleFastInsert().
|
static |
Definition at line 709 of file ginfast.c.
References addDatum(), Assert, KeyArray::categories, FirstOffsetNumber, ginInsertBAEntries(), BuildAccumulator::ginstate, gintuple_get_attrnum(), gintuple_get_key(), i, ItemPointerEquals(), ItemPointerIsValid(), ItemPointerSetInvalid(), KeyArray::keys, KeyArray::nvalues, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and IndexTupleData::t_tid.
Referenced by ginInsertCleanup().
|
static |
Definition at line 554 of file ginfast.c.
References Assert, BufferGetPage(), data, END_CRIT_SECTION, GIN_DELETED, GIN_EXCLUSIVE, GIN_NDELETE_AT_ONCE, GinPageGetMeta, GinPageGetOpaque, GinPageIsDeleted, GinMetaPageData::head, i, InvalidBlockNumber, LockBuffer(), MarkBufferDirty(), GinMetaPageData::nPendingHeapTuples, GinMetaPageData::nPendingPages, IndexBulkDeleteResult::pages_deleted, PageSetLSN(), ReadBuffer(), RecordFreeIndexPage(), REGBUF_STANDARD, REGBUF_WILL_INIT, RelationNeedsWAL, START_CRIT_SECTION, GinMetaPageData::tail, GinMetaPageData::tailFreeSize, UnlockReleaseBuffer(), XLOG_GIN_DELETE_LISTPAGE, XLogBeginInsert(), XLogEnsureRecordSpace(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by ginInsertCleanup().
|
static |
Definition at line 59 of file ginfast.c.
References Assert, BufferGetPage(), PGAlignedBlock::data, data, elog, END_CRIT_SECTION, ERROR, FirstOffsetNumber, GIN_LIST, GinInitBuffer(), GinPageGetOpaque, GinPageSetFullRow, i, IndexTupleSize, InvalidBlockNumber, InvalidOffsetNumber, MarkBufferDirty(), PageAddItem, PageGetExactFreeSpace(), PageSetLSN(), REGBUF_WILL_INIT, RelationGetRelationName, RelationNeedsWAL, size, START_CRIT_SECTION, UnlockReleaseBuffer(), XLOG_GIN_INSERT_LISTPAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by makeSublist().