At Mon, 25 Jul 2022 17:11:32 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in
> 2022-07-25 17:05:57.790 JST [151762] LOG: could not link file "pg_wal/000000010000000000000002" to
"pg_wal/000000010000000000000059":File exists
(Sorry for the broken mail..)
So, this is the race condition between InstallXLogFileSegment and
KeepFileRestoredFromArchive.
We can insert locking on ControlFileLock in the latter to arbitrate
the race condition, but I think it would be better that the
checkpointer gives up renaming believing the file has been added by
recovery, with adding some prerequisites, or confirming recovered
files.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center