public inbox for [email protected]  
help / color / mirror / Atom feed
Clarifying pg_rewind failure risks due to asynchronous file deletions
2+ messages / 2 participants
[nested] [flat]

* Clarifying pg_rewind failure risks due to asynchronous file deletions
@ 2026-03-11 17:44 PG Doc comments form <[email protected]>
  2026-03-12 19:56 ` Re: Clarifying pg_rewind failure risks due to asynchronous file deletions Laurenz Albe <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2026-03-11 17:44 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/app-pgrewind.html
Description:

Reference Page: https://www.postgresql.org/docs/current/app-pgrewind.html

Proposed Enhancement: Include an explicit warning in the **"Description"**
or **"Warnings"** section regarding the requirement for the target data
directory to remain static during the rewind process.

Reasoning: While the documentation states that `pg_rewind` "will fail
immediately if it finds files it cannot write directly to," it does not
currently warn against asynchronous file deletions within the target
`$PGDATA` (or tablespace/WAL directories) while the utility is running.

In high-concurrency or automated environments, background processes—such as
the **WAL summarizer** cleanup, automated log rotations, or external
archiver tools (e.g., `pgbackrest` spooling)—may remove files that
`pg_rewind` has already indexed for synchronization. This results in a fatal
"No such file or directory" error during the final stages of the rewind,
often leaving the target directory in an unrecoverable state.

Suggested Phrasing:

"Warning: The target data directory must remain static during the rewind
operation. Any asynchronous file modifications or deletions—such as those
performed by automated log rotation, WAL summary cleanups, or external
backup tools—may cause `pg_rewind` to fail. If a file is removed after the
synchronization process has begun, the utility may error out, leaving the
target cluster in an inconsistent state that requires a new base backup."






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Clarifying pg_rewind failure risks due to asynchronous file deletions
  2026-03-11 17:44 Clarifying pg_rewind failure risks due to asynchronous file deletions PG Doc comments form <[email protected]>
@ 2026-03-12 19:56 ` Laurenz Albe <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2026-03-12 19:56 UTC (permalink / raw)
  To: [email protected]; [email protected]

On Wed, 2026-03-11 at 17:44 +0000, PG Doc comments form wrote:
> Reference Page: https://www.postgresql.org/docs/current/app-pgrewind.html
> 
> Proposed Enhancement: Include an explicit warning in the **"Description"**
> or **"Warnings"** section regarding the requirement for the target data
> directory to remain static during the rewind process.
> 
> Reasoning: While the documentation states that `pg_rewind` "will fail
> immediately if it finds files it cannot write directly to," it does not
> currently warn against asynchronous file deletions within the target
> `$PGDATA` (or tablespace/WAL directories) while the utility is running.
> 
> In high-concurrency or automated environments, background processes—such as
> the **WAL summarizer** cleanup, automated log rotations, or external
> archiver tools (e.g., `pgbackrest` spooling)—may remove files that
> `pg_rewind` has already indexed for synchronization. This results in a fatal
> "No such file or directory" error during the final stages of the rewind,
> often leaving the target directory in an unrecoverable state.
> 
> Suggested Phrasing:
> 
> "Warning: The target data directory must remain static during the rewind
> operation. Any asynchronous file modifications or deletions—such as those
> performed by automated log rotation, WAL summary cleanups, or external
> backup tools—may cause `pg_rewind` to fail. If a file is removed after the
> synchronization process has begun, the utility may error out, leaving the
> target cluster in an inconsistent state that requires a new base backup."

I'd say that it is obvious that nobody should mess with the target
data directory while pg_rewind is working on it.  Nothing except
PostgreSQL itself should ever mess with the data directory, period.
The WAL summarizer is part of PostgreSQL.  You are not trying to tell
us that you started the PostgreSQL server on the data directory while
you ran pg_rewind, are you?

It is also not documented that you shouldn't power down the machine
while you are running pg_rewind.  Or remove the disk.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-03-12 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-11 17:44 Clarifying pg_rewind failure risks due to asynchronous file deletions PG Doc comments form <[email protected]>
2026-03-12 19:56 ` Laurenz Albe <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox