Re: pg_rewind WAL segments deletion pitfall

Alexander Kukushkin <cyberdemn@gmail.com>

From: Alexander Kukushkin <cyberdemn@gmail.com>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, michael@paquier.xyz, pgsql-hackers@postgresql.org, bungina@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2023-09-12T13:29:46Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

Hi,

Please find attached v5.
What changed:
1. Now we collect which files should be kept  in a separate hash table.
2. Decision whether to keep the file is made only when the file is actually
missing on the source. That is, remaining WAL files will be copied over as
it currently is, although it could be extremely inefficient and unnecessary.
3. Added TAP test that actually at least one file isn't removed.

Regards,
--
Alexander Kukushkin

Commits

  1. Fix newly introduced 010_keep_recycled_wals.pl

  2. Avoid deleting critical WAL segments during pg_rewind