Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use temporary file when compressing rotated logs and atomically renam…
…e to prevent reading incomplete files If another process is watching for `*.gz` files then it's possible to begin reading the archive before it has been completely created, resulting in corruption if the other process is copying the archive to another location (for example: archival to s3). To resolve this, we can use a different suffix when writing the file so that other programs do not read it while it's being created. Once the archive has been completely created, we atomically rename it to the desired file name with the `*.gz` extension, ensuring external programs only ever see the finished archive. Signed-off-by: Chance Zibolski <[email protected]>
- Loading branch information