1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-02 11:44:50 +03:00

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
This commit is contained in:
Tom Lane 2013-01-23 22:08:01 -05:00
parent a79ae0bc0d
commit 14ba9b11ea

View File

@ -1058,6 +1058,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);
}