Re: Elimination of the repetitive code at the SLRU bootstrap functions.

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Evgeny Voropaev <evgeny(dot)voropaev(at)tantorlabs(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Elimination of the repetitive code at the SLRU bootstrap functions.
Date: 2025-02-17 13:00:30
Message-ID: 202502171300.3p53vpgbytob@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Feb-17, Andrey Borodin wrote:

> BootStrapSlruPage() always calls zerofunc(pageno, false) with second argument false.
> In case of every possible argument (ZeroCLOGPage, ZeroCommitTsPage,
> ZeroMultiXactOffsetPage, ZeroMultiXactMemberPage, ZeroSUBTRANSPage) it
> means just a call to SimpleLruZeroPage().
> I think we can safely replace
>
> + slotno = (*zerofunc)(pageno, false);
>
> with
>
> + slotno = SimpleLruZeroPage(pageno);
>
> Thus we will not need zerofunc argument at all.

Good observation. This also suggests another change: because this new
function is used not only for bootstrapping but also during WAL replay,
we can call the new function SimpleLruUnloggedZeroPage() and place it
immediately after SimpleLruZeroPage, instead of at the end of the file.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"La persona que no quería pecar / estaba obligada a sentarse
en duras y empinadas sillas / desprovistas, por cierto
de blandos atenuantes" (Patricio Vogel)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2025-02-17 13:01:09 Re: Parallel CREATE INDEX for GIN indexes
Previous Message Andrey Borodin 2025-02-17 12:18:39 Re: Elimination of the repetitive code at the SLRU bootstrap functions.