24 #define BLOOM_HASH_PROC 1
25 #define BLOOM_OPTIONS_PROC 2
29 #define BLOOM_EQUAL_STRATEGY 1
30 #define BLOOM_NSTRATEGIES 1
46 #define BLOOM_META (1<<0)
47 #define BLOOM_DELETED (2<<0)
57 #define BLOOM_PAGE_ID 0xFF83
60 #define BloomPageGetOpaque(page) ((BloomPageOpaque) PageGetSpecialPointer(page))
61 #define BloomPageGetMaxOffset(page) (BloomPageGetOpaque(page)->maxoff)
62 #define BloomPageIsMeta(page) \
63 ((BloomPageGetOpaque(page)->flags & BLOOM_META) != 0)
64 #define BloomPageIsDeleted(page) \
65 ((BloomPageGetOpaque(page)->flags & BLOOM_DELETED) != 0)
66 #define BloomPageSetDeleted(page) \
67 (BloomPageGetOpaque(page)->flags |= BLOOM_DELETED)
68 #define BloomPageSetNonDeleted(page) \
69 (BloomPageGetOpaque(page)->flags &= ~BLOOM_DELETED)
70 #define BloomPageGetData(page) ((BloomTuple *)PageGetContents(page))
71 #define BloomPageGetTuple(state, page, offset) \
72 ((BloomTuple *)(PageGetContents(page) \
73 + (state)->sizeOfBloomTuple * ((offset) - 1)))
74 #define BloomPageGetNextTuple(state, tuple) \
75 ((BloomTuple *)((Pointer)(tuple) + (state)->sizeOfBloomTuple))
78 #define BLOOM_METAPAGE_BLKNO (0)
79 #define BLOOM_HEAD_BLKNO (1)
86 #define SIGNWORDBITS ((int) (BITS_PER_BYTE * sizeof(BloomSignatureWord)))
91 #define DEFAULT_BLOOM_LENGTH (5 * SIGNWORDBITS)
92 #define MAX_BLOOM_LENGTH (256 * SIGNWORDBITS)
97 #define DEFAULT_BLOOM_BITS 2
98 #define MAX_BLOOM_BITS (MAX_BLOOM_LENGTH - 1)
131 #define BLOOM_MAGICK_NUMBER (0xDBAC0DED)
134 #define BloomMetaBlockN (sizeof(FreeBlockNumberArray) / sizeof(BlockNumber))
136 #define BloomPageGetMeta(page) ((BloomMetaPageData *) PageGetContents(page))
152 #define BloomPageGetFreeSpace(state, page) \
153 (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \
154 - BloomPageGetMaxOffset(page) * (state)->sizeOfBloomTuple \
155 - MAXALIGN(sizeof(BloomPageOpaqueData)))
166 #define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign)
199 ScanKey orderbys,
int norderbys);
206 void *callback_state);
211 double loop_count,
Cost *indexStartupCost,
213 double *indexCorrelation,
double *indexPages);
bytea * bloptions(Datum reloptions, bool validate)
BlockNumber FreeBlockNumberArray[MAXALIGN_DOWN(BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) - MAXALIGN(sizeof(uint16) *2+sizeof(uint32)+sizeof(BloomOptions)))/sizeof(BlockNumber)]
BloomTuple * BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
void BloomInitMetapage(Relation index)
bool blvalidate(Oid opclassoid)
void BloomInitPage(Page page, uint16 flags)
int64 blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
IndexScanDesc blbeginscan(Relation r, int nkeys, int norderbys)
bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
void blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, Selectivity *indexSelectivity, double *indexCorrelation, double *indexPages)
IndexBuildResult * blbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
void blbuildempty(Relation index)
BloomPageOpaqueData * BloomPageOpaque
struct BloomMetaPageData BloomMetaPageData
struct BloomOptions BloomOptions
Buffer BloomNewBuffer(Relation index)
struct BloomPageOpaqueData BloomPageOpaqueData
void BloomFillMetapage(Relation index, Page metaPage)
bool blinsert(Relation index, Datum *values, bool *isnull, ItemPointer ht_ctid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, struct IndexInfo *indexInfo)
struct BloomState BloomState
IndexBulkDeleteResult * blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
struct BloomTuple BloomTuple
uint16 BloomSignatureWord
void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno)
void initBloomState(BloomState *state, Relation index)
IndexBulkDeleteResult * blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
BloomScanOpaqueData * BloomScanOpaque
struct BloomScanOpaqueData BloomScanOpaqueData
void blendscan(IndexScanDesc scan)
void blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
static Datum values[MAXATTR]
#define SizeOfPageHeaderData
#define MAXALIGN_DOWN(LEN)
#define FLEXIBLE_ARRAY_MEMBER
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
FreeBlockNumberArray notFullPage
int bitSize[INDEX_MAX_KEYS]
BloomSignatureWord * sign
Oid collations[INDEX_MAX_KEYS]
FmgrInfo hashFn[INDEX_MAX_KEYS]
BloomSignatureWord sign[FLEXIBLE_ARRAY_MEMBER]
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)