Can we change pg_rewind used without wal_log_hints and data_checksums

From: lchch1990(at)sina(dot)cn
To: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Can we change pg_rewind used without wal_log_hints and data_checksums
Date: 2026-01-15 01:47:39
Message-ID: 6968473b747509.85551803.6d444149@m0.mail.sina.com.cn
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi hackers,

I am thinking about why pg_rewind need wal_log_hints or data_checksums which significantly
limits its usability. I research somewhere can can only find it's for against data
corruption in code comment.

And i come up a case which may need depend on the page consistence after do pg_rewind:
1. We have primary A and standby B.
2. We have a transaction xact1 currently and xact1 modify some pages.
3. Do a checkpoint on A
4. standby B promote
5. xact1 committed on and do a query on all data modified by xact1
6. do pg_rewind on A

If on no page consistence mode, and hack pg_rewind code to force a rewind, then we
may see xact1 on A and can not see xact1 on B. And it's cause unconsistence.

Now I tell myself ,pg_rewind may can not handle this case so we must set wal_log_hints
on to avoid the case. If so we can modify pg_rewind to met this case. If not so, I want
to known the reason or some mail thread discuss that? Thanks.

Here i want to introduce a way to solve the case above:
We need record all transaction ID commited after diverge record and research more wal
before diverge record, we need to find a start lsn(lsn_s) which older than all the
transactions. And we should read from lsn_s to diverge lsn to collect influenced pages
by the transactions. So we can copy them at the rewind phase.

Best Regards,Movead Li

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-01-15 01:48:06 Re: Add IS_INDEX macro to brin and gist index
Previous Message Jacob Champion 2026-01-15 00:42:00 Re: Proposal to allow setting cursor options on Portals