27#define GETWORD(x,i) ( *( (BloomSignatureWord *)(x) + ( (i) / SIGNWORDBITS ) ) )
28#define CLRBIT(x,i) GETWORD(x,i) &= ~( 0x01 << ( (i) % SIGNWORDBITS ) )
29#define SETBIT(x,i) GETWORD(x,i) |= ( 0x01 << ( (i) % SIGNWORDBITS ) )
30#define GETBIT(x,i) ( (GETWORD(x,i) >> ( (i) % SIGNWORDBITS )) & 0x01 )
58 "Length of signature in bits",
70 "Number of bits generated for each index column",
106 .
type = T_IndexAmRoutine,
111 .amcanorderbyop =
false,
113 .amconsistentequality =
false,
114 .amconsistentordering =
false,
115 .amcanbackward =
false,
116 .amcanunique =
false,
117 .amcanmulticol =
true,
118 .amoptionalkey =
true,
119 .amsearcharray =
false,
120 .amsearchnulls =
false,
122 .amclusterable =
false,
123 .ampredlocks =
false,
124 .amcanparallel =
false,
125 .amcanbuildparallel =
false,
126 .amcaninclude =
false,
127 .amusemaintenanceworkmem =
false,
128 .amparallelvacuumoptions =
135 .aminsertcleanup = NULL,
140 .amgettreeheight = NULL,
143 .ambuildphasename = NULL,
145 .amadjustmembers = NULL,
153 .amestimateparallelscan = NULL,
154 .aminitparallelscan = NULL,
155 .amparallelrescan = NULL,
156 .amtranslatestrategy = NULL,
157 .amtranslatecmptype = NULL,
174 for (
i = 0;
i <
index->rd_att->natts;
i++)
183 if (!
index->rd_amcache)
198 elog(
ERROR,
"Relation is not a bloom index");
202 elog(
ERROR,
"Relation is not a bloom index");
246 x = 16807 * lo - 2836 * hi;
287 for (
j = 0;
j <
state->opts.bitSize[attno];
j++)
307 for (
i = 0;
i <
state->nColumns;
i++)
340 memcpy(itup, tuple,
state->sizeOfBloomTuple);
412 opaque->
flags = flags;
496 return (
bytea *) rdopts;
static bool validate(Port *port, const char *auth)
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
IndexBulkDeleteResult * blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
#define BloomPageGetTuple(state, page, offset)
#define BLOOM_NSTRATEGIES
IndexBulkDeleteResult * blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
#define BLOOM_OPTIONS_PROC
uint16 BloomSignatureWord
#define BloomPageIsDeleted(page)
#define DEFAULT_BLOOM_LENGTH
void blendscan(IndexScanDesc scan)
#define BLOOM_METAPAGE_BLKNO
#define BloomPageIsMeta(page)
void blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
static int32 myRand(void)
void BloomInitPage(Page page, uint16 flags)
Datum blhandler(PG_FUNCTION_ARGS)
BloomTuple * BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
PG_FUNCTION_INFO_V1(blhandler)
static BloomOptions * makeDefaultBloomOptions(void)
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 BloomInitMetapage(Relation index, ForkNumber forknum)
bytea * bloptions(Datum reloptions, bool validate)
void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno)
static void mySrand(uint32 seed)
void initBloomState(BloomState *state, Relation index)
static relopt_parse_elt bl_relopt_tab[INDEX_MAX_KEYS+1]
static Datum values[MAXATTR]
BlockNumber BufferGetBlockNumber(Buffer buffer)
void LockBuffer(Buffer buffer, BufferLockMode mode)
Buffer ExtendBufferedRel(BufferManagerRelation bmr, ForkNumber forkNum, BufferAccessStrategy strategy, uint32 flags)
bool ConditionalLockBuffer(Buffer buffer)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy)
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
static Page BufferGetPage(Buffer buffer)
void PageInit(Page page, Size pageSize, Size specialSize)
PageHeaderData * PageHeader
static bool PageIsNew(const PageData *page)
#define palloc0_object(type)
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
Assert(PointerIsAligned(start, uint64))
FmgrInfo * index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum)
BlockNumber GetFreeIndexPage(Relation rel)
if(TABLE==NULL||TABLE_index==NULL)
#define AccessExclusiveLock
char * MemoryContextStrdup(MemoryContext context, const char *string)
void * MemoryContextAlloc(MemoryContext context, Size size)
void * palloc0(Size size)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
static AmcheckOptions opts
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int32 DatumGetInt32(Datum X)
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)
BloomSignatureWord sign[FLEXIBLE_ARRAY_MEMBER]
#define VACUUM_OPTION_PARALLEL_CLEANUP
#define VACUUM_OPTION_PARALLEL_BULKDEL
static void SET_VARSIZE(void *PTR, Size len)