Re: Changed behavior in rewriteheap - Mailing list pgsql-hackers

From Erik Nordström
Subject Re: Changed behavior in rewriteheap
Date
Msg-id CACAa4V+Vbe1BWWnssu30nMBvi8tShn41e_cs-PtUpmbEvFE-eQ@mail.gmail.com
Whole thread Raw
In response to Re: Changed behavior in rewriteheap  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On Fri, Nov 22, 2024 at 3:53 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 22/11/2024 15:56, Erik Nordström wrote:
> Yes, it solves the issue so it looks good.
>
> Just a minor nit: the code uses both blokno as local variable for
> pending_writes[i].blkno and directly accessing pending_writes[i].blkno.
> Maybe it is better to just use the local variable. For example, change
>
> ++ b/src/backend/storage/smgr/bulk_write.c
> @@ -304,7 +304,8 @@ smgr_bulk_flush(BulkWriteState *bulkstate)
>                          }
>
>                          smgrextend(bulkstate->smgr, bulkstate->forknum,
> blkno, page, true);
> -                       bulkstate->relsize = pending_writes[i].blkno + 1;
> +                       bulkstate->relsize++;
> +                       Assert(bulkstate->relsize == blkno + 1);
>
> Just a suggestion.

Made that change and committed to master and REL_17_STABLE. I didn't
bother with the assertion though. Also I removed the 'pages_written'
field, it was not used for anything anymore.

Sounds good. Thank you again!

-Erik

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Changed behavior in rewriteheap