Re: pg_rewind reports "no rewind required" due to stale minRecoveryPoint

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Osama Abdul Qader <osamaabdulqaderpostgres(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Jan Nidzwetzki <jan(at)planetscale(dot)com>, hlinnaka(at)iki(dot)fi
Subject: Re: pg_rewind reports "no rewind required" due to stale minRecoveryPoint
Date: 2026-11-28 12:00:26
Message-ID: CAN4CZFPDdNc3qaJk-D3sgiqqivgzMJyPZWv8p5wrMSuCC1LcWw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

Isn't this the same change that Adam Lee proposed in [1] earlier this
year for recovery_target_action = shutdown? His patch advanced
minRecoveryPoint to the replay position at every restartpoint and then
Heikki suggested calling UpdateMinRecoveryPoint(), which is what your
patch does.

In that thread Michael and Horiguchi-san argued against it, but this
could be another example in favor of it.

From a different perspective, isn't this something that could be
possibly fixed in pg_rewind?

For a standby target it could read the WAL forward from
minRecoveryPoint until the first invalid record, and use that as the
end of the target's WAL. That doesn't change what minRecoveryPoint
means, and it also works for a standby that was stopped by a server
without the fix. See the attached quick PoC.

However, looking at your other patch [2]: it uses the minRecoveryPoint
of a stopped standby as the consistency point for the copied files.
With hot_standby = off on the source a replayed commit reaches pg_xact
without moving minRecoveryPoint, so doesn't that patch need this
server side change? If yes, that's an argument for keeping it, even if
pg_rewind looks at the target's WAL.

[1]: https://www.postgresql.org/message-id/aczc9cxkr7SEHXV5%40MAC-CVW1VHW5R6
[2]: https://www.postgresql.org/message-id/51de3e6e-01de-4740-ad11-1bf69ff0d68d%40planetscale.com

Attachment Content-Type Size
nocfbot-poc-end-of-target-wal.txt text/plain 4.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-11-28 12:13:58 Re: pg_rewind WAL segments deletion pitfall
Previous Message Kirill Reshke 2026-11-28 11:20:28 Re: CYCLE over calculates windows functions