]> granicus.if.org Git - postgresql/commitdiff
For testing purposes, reinsert a timeout in pgstat.c's wait call.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2012 19:03:14 +0000 (15:03 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2012 19:03:14 +0000 (15:03 -0400)
Test results from buildfarm members mastodon/narwhal (Windows Server 2003)
make it look like that platform just plain loses FD_READ events
occasionally, and the only reason our previous coding seemed to work was
that it timed out every couple of seconds and retried the whole operation.
Try to verify this by reinserting a finite timeout into the pgstat loop.
This isn't meant to be a permanent patch either, just to confirm or
disprove a theory.

src/backend/postmaster/pgstat.c

index 4c2cc6557235568d1c546e696cc788893862c6d9..a7ca8cd60d716e820492601eb8d49e9e83bbea2b 100644 (file)
@@ -3241,10 +3241,11 @@ PgstatCollectorMain(int argc, char *argv[])
                elog(LOG, "pgstat: waiting");
 
                /* Sleep until there's something to do */
+               /* XXX should not need a timeout here */
                wr = WaitLatchOrSocket(&pgStatLatch,
-                                                          WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE,
+                                                          WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT,
                                                           pgStatSock,
-                                                          -1L);
+                                                          2000L);
 
                elog(LOG, "pgstat: wait result 0x%x", wr);