If process A copies files to some location loc and process B regularly copies the files from loc to some other location, can B read a file that is currently in the process of being copied to loc by A?
I'm using Ubuntu Linux 12.04 if that's important.
Background information: I want to continuously backup a PostgreSQL cluster. PostgreSQL provides WAL archiving for that. It works by having the database call a script that copies a completed WAL file to some backup location.
I want another process to regularly copy the backed up WAL files to another server. If a WAL file is currently being copied by the database, can the second process still read the file without running into some EOF condition before the file is copied as a whole?
In other words: Can I do the following with no synchronization between A and B?
A B cp pg_xlog/some_wal_file /backup/ scp /backup/* user@remote-machine:/backups/