| From: | Postgress Cybrosys <postgress(at)cybrosys(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Fix incorrect false positive rate formatting in create_and_test_bloom() |
| Date: | 2026-03-25 06:51:35 |
| Message-ID: | CAG+=MFUzje9-4jAbS=ZWGPA0Ggg7wuPkh5dadcY5MnwA10+gFg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
I noticed a bug in src/test/modules/test_bloomfilter/test_bloomfilter.c
where the false positive rate is displayed incorrectly in
create_and_test_bloom().
The issue is in the ereport() call:
errmsg_internal("seed: " UINT64_FORMAT " false positives: "
INT64_FORMAT " (%.6f%%) bitset %.2f%% set",
seed, nfalsepos, (double) nfalsepos / nelements,
100.0 * bloom_prop_bits_set(filter))
The format specifier %.6f%% expects a value already scaled to a percentage,
but (double) nfalsepos / nelements produces a raw fraction. This means a
true false positive rate of 0.5% is displayed as 0.005000% — 100x smaller
than the actual value.
This is inconsistent with the very next argument, bloom_prop_bits_set(),
which is correctly multiplied by 100.0 before being passed to its %.2f%%
format specifier.
The fix is straightforward — multiply the ratio by 100.0:
- seed, nfalsepos, (double) nfalsepos / nelements,
+ seed, nfalsepos, 100.0 * (double) nfalsepos / nelements,
Patch is attached.
Thanks & Regards,
*Jhon k*
Postgres Specialist
Project & IT Department
Cybrosys Technologies
Mobile
postgress(at)cybrosys(dot)com
+91 8606827707
+91 8606827707
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-incorrect-false-positive-rate-formatting-in-crea.patch | text/x-patch | 1.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Lukas Fittl | 2026-03-25 06:52:13 | Re: pg_buffercache: Add per-relation summary stats |
| Previous Message | Masahiko Sawada | 2026-03-25 06:50:13 | Re: Introduce XID age based replication slot invalidation |