23 #define MAX_ELEMENT_BYTES 21
25 #define FPOSITIVE_THRESHOLD 0.01
37 for (
i = 0;
i < nelements;
i++)
58 for (
i = 0;
i < nelements;
i++)
79 bloom_work_mem = (1L << power) / 8L / 1024L;
81 elog(
DEBUG1,
"bloom_work_mem (KB): %d", bloom_work_mem);
97 seed, nfalsepos, (
double) nfalsepos / nelements,
121 if (power < 23 || power > 32)
122 elog(
ERROR,
"power argument must be between 23 and 32 inclusive");
125 elog(
ERROR,
"invalid number of tests: %d", tests);
128 elog(
ERROR,
"invalid number of elements: %d", tests);
130 for (
i = 0;
i < tests;
i++)
void bloom_free(bloom_filter *filter)
bloom_filter * bloom_create(int64 total_elems, int bloom_work_mem, uint64 seed)
double bloom_prop_bits_set(bloom_filter *filter)
bool bloom_lacks_element(bloom_filter *filter, unsigned char *elem, size_t len)
void bloom_add_element(bloom_filter *filter, unsigned char *elem, size_t len)
int errmsg_internal(const char *fmt,...)
#define ereport(elevel,...)
#define PG_GETARG_INT64(n)
#define PG_GETARG_INT32(n)
#define CHECK_FOR_INTERRUPTS()
int32 pg_prng_int32p(pg_prng_state *state)
pg_prng_state pg_global_prng_state
static chr element(struct vars *v, const chr *startp, const chr *endp)
static void populate_with_dummy_strings(bloom_filter *filter, int64 nelements)
static int64 nfalsepos_for_missing_strings(bloom_filter *filter, int64 nelements)
PG_FUNCTION_INFO_V1(test_bloomfilter)
Datum test_bloomfilter(PG_FUNCTION_ARGS)
static void create_and_test_bloom(int power, int64 nelements, int callerseed)
#define MAX_ELEMENT_BYTES
#define FPOSITIVE_THRESHOLD