aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-01-23 22:08:01 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-01-23 22:08:01 -0500
commit8556869f2f31ce6f5fab68de08fb1556a2134080 (patch)
tree92cdd1d82ee88aceec87599c23f95792e8373d9f
parentca5db759b8b7f2574a34842fc9284e58618e15b9 (diff)
downloadpostgresql-8556869f2f31ce6f5fab68de08fb1556a2134080.tar.gz
postgresql-8556869f2f31ce6f5fab68de08fb1556a2134080.zip
Fix failure to rotate postmaster log file for size reasons on Windows.
When we eliminated "unnecessary" wakeups of the syslogger process, we broke size-based logfile rotation on Windows, because on that platform data transfer is done in a separate thread. While non-Windows platforms would recheck the output file size after every log message, Windows only did so when the control thread woke up for some other reason, which might be quite infrequent. Per bug #7814 from Tsunezumi. Back-patch to 9.2 where the problem was introduced. Jeff Janes
-rw-r--r--src/backend/postmaster/syslogger.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 1c62bfe03a2..534d69ec140 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -1059,6 +1059,15 @@ pipeThread(void *arg)
bytes_in_logbuffer += bytesRead;
process_pipe_input(logbuffer, &bytes_in_logbuffer);
}
+
+ /*
+ * If we've filled the current logfile, nudge the main thread to do a
+ * log rotation.
+ */
+ if (Log_RotationSize > 0 &&
+ ftell(syslogFile) >= Log_RotationSize * 1024L)
+ SetLatch(&sysLoggerLatch);
+
LeaveCriticalSection(&sysloggerSection);
}