56 memcpy(page, buildstate->
data.
data, BLCKSZ);
68 buildstate->
count = 0;
76 bool *isnull,
bool tupleIsAlive,
void *
state)
104 elog(
ERROR,
"could not add new bloom tuple to empty page");
129 elog(
ERROR,
"index \"%s\" already contains data",
136 memset(&buildstate, 0,
sizeof(buildstate));
139 "Bloom build temporary context",
149 if (buildstate.
count > 0)
195 "Bloom insert temporary context",
260 nStart = metaData->
nStart;
263 if (nStart < metaData->nEnd &&
280 if (nStart >= metaData->
nEnd)
297 metaData->
nStart = nStart;
324 elog(
ERROR,
"could not add new bloom tuple to empty page");
static void initCachedPage(BloomBuildState *buildstate)
void blbuildempty(Relation index)
PG_MODULE_MAGIC_EXT(.name="bloom",.version=PG_VERSION)
static void flushCachedPage(Relation index, BloomBuildState *buildstate)
IndexBuildResult * blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
static void bloomBuildCallback(Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)
bool blinsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
#define InvalidBlockNumber
void BloomInitPage(Page page, uint16 flags)
#define BloomPageGetMeta(page)
BloomTuple * BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
Buffer BloomNewBuffer(Relation index)
void BloomInitMetapage(Relation index, ForkNumber forknum)
#define BloomPageIsDeleted(page)
void initBloomState(BloomState *state, Relation index)
#define BLOOM_METAPAGE_BLKNO
static Datum values[MAXATTR]
BlockNumber BufferGetBlockNumber(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
#define RelationGetNumberOfBlocks(reln)
static Page BufferGetPage(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
static bool PageIsNew(const PageData *page)
Page GenericXLogRegisterBuffer(GenericXLogState *state, Buffer buffer, int flags)
GenericXLogState * GenericXLogStart(Relation relation)
XLogRecPtr GenericXLogFinish(GenericXLogState *state)
void GenericXLogAbort(GenericXLogState *state)
#define GENERIC_XLOG_FULL_IMAGE
Assert(PointerIsAligned(start, uint64))
void MemoryContextReset(MemoryContext context)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define CHECK_FOR_INTERRUPTS()
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define RelationGetRelationName(relation)
FreeBlockNumberArray notFullPage
static double table_index_build_scan(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool progress, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)