30 #define GETWORD(x,i) ( *( (BloomSignatureWord *)(x) + ( (i) / SIGNWORDBITS ) ) )
31 #define CLRBIT(x,i) GETWORD(x,i) &= ~( 0x01 << ( (i) % SIGNWORDBITS ) )
32 #define SETBIT(x,i) GETWORD(x,i) |= ( 0x01 << ( (i) % SIGNWORDBITS ) )
33 #define GETBIT(x,i) ( (GETWORD(x,i) >> ( (i) % SIGNWORDBITS )) & 0x01 )
61 "Length of signature in bits",
73 "Number of bits generated for each index column",
168 for (
i = 0;
i <
index->rd_att->natts;
i++)
177 if (!
index->rd_amcache)
192 elog(
ERROR,
"Relation is not a bloom index");
196 elog(
ERROR,
"Relation is not a bloom index");
240 x = 16807 * lo - 2836 * hi;
281 for (
j = 0;
j <
state->opts.bitSize[attno];
j++)
298 res->heapPtr = *iptr;
301 for (
i = 0;
i <
state->nColumns;
i++)
414 opaque->
flags = flags;
496 return (
bytea *) rdopts;
void blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)
void blbuildempty(Relation index)
IndexBuildResult * blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
bool blinsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
#define InvalidBlockNumber
#define BloomPageGetOpaque(page)
#define BloomPageGetFreeSpace(state, page)
bool blvalidate(Oid opclassoid)
int64 blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
#define BloomPageGetMeta(page)
IndexScanDesc blbeginscan(Relation r, int nkeys, int norderbys)
#define DEFAULT_BLOOM_BITS
struct BloomMetaPageData BloomMetaPageData
#define BLOOM_MAGICK_NUMBER
#define BloomPageGetTuple(state, page, offset)
#define BLOOM_NSTRATEGIES
IndexBulkDeleteResult * blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
#define BLOOM_OPTIONS_PROC
uint16 BloomSignatureWord
#define BloomPageIsDeleted(page)
#define DEFAULT_BLOOM_LENGTH
IndexBulkDeleteResult * blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
void blendscan(IndexScanDesc scan)
#define BLOOM_METAPAGE_BLKNO
#define BloomPageIsMeta(page)
void blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
bytea * bloptions(Datum reloptions, bool validate)
BloomTuple * BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
static int32 myRand(void)
void BloomInitMetapage(Relation index)
void BloomInitPage(Page page, uint16 flags)
Datum blhandler(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(blhandler)
bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
static relopt_kind bl_relopt_kind
Buffer BloomNewBuffer(Relation index)
void BloomFillMetapage(Relation index, Page metaPage)
void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno)
static void mySrand(uint32 seed)
void initBloomState(BloomState *state, Relation index)
static BloomOptions * makeDefaultBloomOptions(void)
static relopt_parse_elt bl_relopt_tab[INDEX_MAX_KEYS+1]
static Datum values[MAXATTR]
BlockNumber BufferGetBlockNumber(Buffer buffer)
bool ConditionalLockBuffer(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
static Page BufferGetPage(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
void PageInit(Page page, Size pageSize, Size specialSize)
PageHeaderData * PageHeader
static bool PageIsNew(Page page)
static void PGresult * res
elog(ERROR, "%s: %s", p2, msg)
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt)
#define PG_RETURN_POINTER(x)
Page GenericXLogRegisterBuffer(GenericXLogState *state, Buffer buffer, int flags)
GenericXLogState * GenericXLogStart(Relation relation)
XLogRecPtr GenericXLogFinish(GenericXLogState *state)
#define GENERIC_XLOG_FULL_IMAGE
FmgrInfo * index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum)
BlockNumber GetFreeIndexPage(Relation rel)
if(TABLE==NULL||TABLE_index==NULL)
Assert(fmt[strlen(fmt) - 1] !='\n')
void LockRelationForExtension(Relation relation, LOCKMODE lockmode)
void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode)
#define AccessExclusiveLock
MemoryContext TopMemoryContext
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void * MemoryContextAlloc(MemoryContext context, Size size)
char * MemoryContextStrdup(MemoryContext context, const char *string)
static AmcheckOptions opts
static int32 DatumGetInt32(Datum X)
#define RELATION_IS_LOCAL(relation)
void add_int_reloption(bits32 kinds, const char *name, const char *desc, int default_val, int min_val, int max_val, LOCKMODE lockmode)
void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)
relopt_kind add_reloption_kind(void)
ambuildphasename_function ambuildphasename
ambuildempty_function ambuildempty
amvacuumcleanup_function amvacuumcleanup
amoptions_function amoptions
amestimateparallelscan_function amestimateparallelscan
amrestrpos_function amrestrpos
aminsert_function aminsert
amendscan_function amendscan
amparallelrescan_function amparallelrescan
amcostestimate_function amcostestimate
amadjustmembers_function amadjustmembers
amgettuple_function amgettuple
amcanreturn_function amcanreturn
amgetbitmap_function amgetbitmap
amproperty_function amproperty
ambulkdelete_function ambulkdelete
amvalidate_function amvalidate
ammarkpos_function ammarkpos
bool amusemaintenanceworkmem
ambeginscan_function ambeginscan
amrescan_function amrescan
aminitparallelscan_function aminitparallelscan
uint8 amparallelvacuumoptions
#define VACUUM_OPTION_PARALLEL_CLEANUP
#define VACUUM_OPTION_PARALLEL_BULKDEL
#define SET_VARSIZE(PTR, len)