| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | Greg Burd <greg(at)burd(dot)me>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add bms_offset_members() function for bitshifting Bitmapsets |
| Date: | 2026-08-23 01:38:17 |
| Message-ID: | CAApHDvpfZqdMRmR-6W9UXb+Tanex5wK6PsL=XzYCV4P3pD36Ng@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, 9 Jul 2026 at 11:55, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> I pushed a change to make seed int64 instead. It's still possible to
> specify the full range of possible values that GetCurrentTimestamp()
> can (or could ever) return with the int64 type. This way, there's no
> longer a mismatch in the format specifier for elog and the type we're
> formatting. That's an improvement, so thanks.
I was just in this area again and noticed that the nmembers
calculation does not take into account the min_value parameter. The
bad code is:
nmembers = pg_prng_uint32(&state) % max_range + min_value;
That should really be subtracting the min_value, as I had intended
nmembers to do was populate a random set of members in the range
specified by the function. While there, I noticed that the parameter
names are not very consistently named and having the max_value before
the min_value seems weird too. I understand test_random_operations()
has it that way. I didn't adjust that function. Maybe that could be
done separately since it's also in v19, whereas
test_random_offset_operations() is new to v20.
I've attached a patch which fixes this plus a few more things that
Claude code pointed out to me when I asked it to review my changes.
Those are primarily around overflow risk if max_value was given as
INT32_MAX.
David
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-incorrect-nmembers-calculation-in-test_bitmap.patch | application/octet-stream | 5.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Ray | 2026-08-23 02:05:49 | Re: pg_xmin_horizon: a system view of everything pinning the xmin horizon |
| Previous Message | Peter Geoghegan | 2026-08-22 23:59:13 | Re: toast table corrupted by vacuum - missing chunk number 0 for toast value |