Re: Making pg_rewind faster

From: John H <johnhyvr(at)gmail(dot)com>
To: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Justin Kwan <justinpkwan(at)outlook(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, vignesh ravichandran <admin(at)viggy28(dot)dev>, "hlinnaka(at)iki(dot)fi" <hlinnaka(at)iki(dot)fi>
Subject: Re: Making pg_rewind faster
Date: 2025-10-16 22:51:56
Message-ID: CA+-JvFuUu05J=Ma__6gfQpV9Gya4O5kT04oBkPt7nMj5NXt09A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Oct 15, 2025 at 7:27 AM Srinath Reddy Sadipiralla
<srinath2133(at)gmail(dot)com> wrote:

>
> TBH first it seemed to me a good coding practice for future proofing,
> then i checked if there's any place in postgres we are doing
> something similar ,then found 1 in src/include/access/gist.h
>
> typedef struct GISTDeletedPageContents
> {
> /* last xid which could see the page in a scan */
> FullTransactionId deleteXid;
> } GISTDeletedPageContents;
>

It makes more sense to me if we expect the struct or same set of arguments
to be reused in different places / want a stable API reference. I don't think
we want everything to be wrapped around a struct for functions just in case.

> ..
> thanks for updating, i have attached a diff patch on
> top of v9-0001 patch , where i tried to add more tests
> ...

Thank you for the diff! Your changes are a lot cleaner and I've included it in
the latest patch. One difference I've made is instead of additionally logging in
decide_wal_file_action

> + pg_log_debug("WAL segment \"%s\" is copied to target", fname);

I realized we are already logging the WAL segments that are copied over in
print_filemap so I've updated the test to check for that instead

> qr/pg_wal\/$corrupt_wal_seg \(COPY\)/

I also updated the error message for the last three checks.

Thanks,

--
John Hsu - Amazon Web Services

Attachment Content-Type Size
v10-0001-Avoid-copying-WAL-segments-before-divergence-to-.patch application/octet-stream 17.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John H 2025-10-16 22:55:06 Re: Making pg_rewind faster
Previous Message Tomas Vondra 2025-10-16 22:28:22 Re: Optimizing ResouceOwner to speed up COPY