Skip to content

Commit 14ba9b1

Browse files
committed
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
1 parent a79ae0b commit 14ba9b1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/backend/postmaster/syslogger.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,15 @@ pipeThread(void *arg)
10581058
bytes_in_logbuffer += bytesRead;
10591059
process_pipe_input(logbuffer, &bytes_in_logbuffer);
10601060
}
1061+
1062+
/*
1063+
* If we've filled the current logfile, nudge the main thread to do a
1064+
* log rotation.
1065+
*/
1066+
if (Log_RotationSize > 0 &&
1067+
ftell(syslogFile) >= Log_RotationSize * 1024L)
1068+
SetLatch(&sysLoggerLatch);
1069+
10611070
LeaveCriticalSection(&sysloggerSection);
10621071
}
10631072

0 commit comments

Comments
 (0)