pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Reduce scope of heap vacuum per_buffer_data
2+ messages / 1 participants
[nested] [flat]

* pgsql: Reduce scope of heap vacuum per_buffer_data
@ 2025-02-18 14:30 Melanie Plageman <melanieplageman@gmail.com>
  2025-02-18 16:24 ` Re: pgsql: Reduce scope of heap vacuum per_buffer_data Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Melanie Plageman @ 2025-02-18 14:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Reduce scope of heap vacuum per_buffer_data

Move lazy_scan_heap()'s per_buffer_data variable into a tighter scope.
In lazy_scan_heap()'s phase I heap vacuuming, the read stream API
returns a pointer to the next block number to vacuum. As long as
read_stream_next_buffer() returns a valid buffer, per_buffer_data should
always be valid.

Move per_buffer_data into a tighter scope and make sure it is reset to
NULL on each iteration so that we get a core dump instead of bogus data
from a previous block if something goes wrong in the read stream API.

Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/626104.1739729538%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c623e8593ec4ee6987f3cd9350ced7caf8526ed2

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Reduce scope of heap vacuum per_buffer_data
  2025-02-18 14:30 pgsql: Reduce scope of heap vacuum per_buffer_data Melanie Plageman <melanieplageman@gmail.com>
@ 2025-02-18 16:24 ` Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Melanie Plageman @ 2025-02-18 16:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

On Tue, Feb 18, 2025 at 9:30 AM Melanie Plageman
<melanieplageman@gmail.com> wrote:
>
> Reduce scope of heap vacuum per_buffer_data
>
> Move lazy_scan_heap()'s per_buffer_data variable into a tighter scope.
> In lazy_scan_heap()'s phase I heap vacuuming, the read stream API
> returns a pointer to the next block number to vacuum. As long as
> read_stream_next_buffer() returns a valid buffer, per_buffer_data should
> always be valid.

Realized I forgot an important word in the commit message.
per_buffer_data doesn't point to the block number. It points to info
about the next block. Commit message should say "the read stream API
returns a pointer to information about the next block to vacuum". Oh
well... There is nothing I can do now.

- Melanie





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-02-18 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18 14:30 pgsql: Reduce scope of heap vacuum per_buffer_data Melanie Plageman <melanieplageman@gmail.com>
2025-02-18 16:24 ` Melanie Plageman <melanieplageman@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox