12 MB threshold for rename versus truncate

This commit is contained in:
Oliver Gorwits
2015-01-24 21:01:47 +00:00
parent 4f9167d6f4
commit 3c4a363c78
2 changed files with 6 additions and 4 deletions

View File

@@ -155,8 +155,9 @@ sub rotate_logs {
}
# if the log file's about 10M then the race condition in copy/truncate
# has a low probability. if the file's larger, then we rename and kill
if ((-s $log_file) > (11 * 1024768)) {
# has a low risk of data loss. if the file's larger, then we rename and
# kill.
if ((-s $log_file) > (12 * 1024768)) {
rename $log_file, $log_file .'.1';
signal_child('TERM', $child);
$child = fork_and_start(@_);

View File

@@ -169,8 +169,9 @@ sub rotate_logs {
}
# if the log file's about 10M then the race condition in copy/truncate
# has a low probability. if the file's larger, then we rename and kill
if ((-s $log_file) > (15 * 1024768)) {
# has a low risk of data loss. if the file's larger, then we rename and
# kill.
if ((-s $log_file) > (12 * 1024768)) {
rename $log_file, $log_file .'.1';
signal_child('HUP', $child);
}