Re: Remove fls(), use pg_bitutils.h facilities instead?
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
David Rowley <dgrowleyml@gmail.com>
Date: 2022-07-21T08:13:52Z
Lists: pgsql-hackers
Attachments
- v3-0001-Extend-size_t-support-in-pg_bitutils.h.patch (text/x-patch) patch v3-0001
- v3-0002-Remove-fls-function.patch (text/x-patch) patch v3-0002
On Thu, Jul 21, 2022 at 1:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > How is it sane to ask for a segment bin for zero pages? Seems like > something should have short-circuited such a case well before here. It's intended. There are two ways you can arrive here with n == 0: * There's a special case in execParallel.c that creates a DSA segment "in-place" with initial size dsa_minimum_size(). That's because we don't know yet if we have any executor nodes that need a DSA segment (Parallel Hash, Parallel Bitmap Heap Scan), so we create one with the minimum amount of space other than the DSA control meta-data, so you get an in-place segment 0 with 0 usable pages. As soon as someone tries to allocate one byte, the first external DSM segment will be created. * A full segment can be re-binned into slot 0. On Thu, Jul 21, 2022 at 1:48 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Seems like passing a size_t to pg_leftmost_one_pos32 isn't great. > It was just as wrong before (if the caller-supplied argument is > indeed a size_t), but no time like the present to fix it. > > We could have pg_bitutils.h #define pg_leftmost_one_pos_size_t > as the appropriate one of pg_leftmost_one_pos32/64, perhaps. Yeah.
Commits
-
Remove fls(), use pg_leftmost_one_pos32() instead.
- 4f1f5a7f85ce 16.0 landed
-
Extend size_t support in pg_bitutils.h.
- 3225399021b6 16.0 landed
-
Support fls().
- 4f658dc851a7 9.2.0 cited