Re: Elimination of the repetitive code at the SLRU bootstrap functions. - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Elimination of the repetitive code at the SLRU bootstrap functions.
Date
Msg-id 202502171300.3p53vpgbytob@alvherre.pgsql
Whole thread Raw
In response to Re: Elimination of the repetitive code at the SLRU bootstrap functions.  (Andrey Borodin <x4mmm@yandex-team.ru>)
List 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)



pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Elimination of the repetitive code at the SLRU bootstrap functions.
Next
From: Matthias van de Meent
Date:
Subject: Re: Parallel CREATE INDEX for GIN indexes