At Mon, 07 Jun 2021 15:57:00 +0900, Tatsuro Yamada <tatsuro.yamada...@nttcom.co.jp> wrote in > Hi Horiguchi-san, > > >> Regarding "test ! -f", > >> I am wondering how many people are using the test command for > >> archive_command. If I remember correctly, the guide provided by > >> NTT OSS Center that we are using does not recommend using the test > >> command. > > I think, as the PG-REX documentation says, the simple cp works well as > > far as the assumption of PG-REX - no double failure happenes, and > > following the instruction - holds. > > > I believe that this assumption started to be wrong after > archive_mode=always was introduced. As far as I can tell, it doesn't > happen when it's archive_mode=on.
?? Doesn't *simple* cp (without "test") work for you? I meant that the operating assumption of PG-REX ensures that overwriting doesn't cause a problem. > > Otherwise the documentation would need someting like the following if > > we assume the current behavior. > > > >> The archive command should generally be designed to refuse to > >> overwrite any pre-existing archive file. This is an important safety > >> feature to preserve the integrity of your archive in case of > >> administrator error (such as sending the output of two different > >> servers to the same archive directory). > > + For standby with the setting archive_mode=always, there's a case > > where > > + the same file is archived more than once. For safety, it is > > + recommended that when the destination file exists, the > > archive_command > > + returns zero if it is byte-identical to the source file. > > > Agreed. > That is same solution as I mentioned earlier. > If possible, it also would better to write it postgresql.conf (that > might > be overkill?!). Mmmm, I didn't noticed that. I don't think such a complex caveat fits the configuration file. And if we need such a caveart there, it might be the sign that we need to fix the causal behavior... regards. -- Kyotaro Horiguchi NTT Open Source Software Center