Nagy László Zsolt wrote: > Let's suppose that a replication master is writting a WAL segment file > into a directory. That directory is mounted on the replication slave. Is > it possible that the slave will try to read a WAL segment file that is > not yet fully flushed to disk? I did not find any requirement in the > official documentation about this. How does it work? Do I have to copy > segments to temp files, and rename them when they are fully flushed to > disk? Or is it okay to have half complete files in the archive dir for a > while? I suppose you are talking about "archive_command" here. If the file restored with "restore_command" is too small, the operation fails, and you get a DEBUG1 message: archive file "..." has wrong size: ... instead of ... So nothing can go wrong there. > And finally: if I also enable streaming replication, then it seems that > log file shipping is not needed at all. If I omit archive_command and > restore_command from the configs, and setup the replication slots and > primary_conninfo only, then it seems to be working just fine. But when > the network goes down for a while, then the slave goes out of sync and > it cannot recover. It was not clear for me from the documentation, but > am I right in that I can combine log file shipping with streaming > replication, and achieve small replication delays plus the ability to > recover after a longer period if network outage? If you use a replication slot, the standby will never get out of sync because the primary will retain all WAL that the standby has not received yet. Streaming replication together with archive recovery is only useful if you are *not* using replication slots. Yours, Laurenz Albe