diff options
| author | Tom Lane | 2007-01-26 20:06:52 +0000 |
|---|---|---|
| committer | Tom Lane | 2007-01-26 20:06:52 +0000 |
| commit | 4355d214c248c959cfbcd974b5e9ba8a6bf81074 (patch) | |
| tree | 4e53e382434fa1e61199caf90a679c842c1cc49f /src/backend/postmaster | |
| parent | 8ff2bccee31a7be12f653bc533b3e76c052534f8 (diff) | |
On Windows, use pgwin32_waitforsinglesocket() instead of select() to wait for
input in the stats collector. Our select() emulation is apparently buggy
for UDP sockets :-(. This should resolve problems with stats collection
(and hence autovacuum) failing under more than minimal load. Diagnosis
and patch by Magnus Hagander.
Patch probably needs to be back-ported to 8.1 and 8.0, but first let's
see if it makes the buildfarm happy...
Diffstat (limited to 'src/backend/postmaster')
| -rw-r--r-- | src/backend/postmaster/pgstat.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 97c11d0fb00..6a5907c466e 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -13,7 +13,7 @@ * * Copyright (c) 2001-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.143 2007/01/11 23:06:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.144 2007/01/26 20:06:52 tgl Exp $ * ---------- */ #include "postgres.h" @@ -1657,12 +1657,14 @@ PgstatCollectorMain(int argc, char *argv[]) int len; PgStat_Msg msg; +#ifndef WIN32 #ifdef HAVE_POLL struct pollfd input_fd; #else struct timeval sel_timeout; fd_set rfds; #endif +#endif IsUnderPostmaster = true; /* we are a postmaster subprocess now */ @@ -1724,7 +1726,7 @@ PgstatCollectorMain(int argc, char *argv[]) * Setup the descriptor set for select(2). Since only one bit in the set * ever changes, we need not repeat FD_ZERO each time. */ -#ifndef HAVE_POLL +#if !defined(HAVE_POLL) && !defined(WIN32) FD_ZERO(&rfds); #endif @@ -1771,8 +1773,10 @@ PgstatCollectorMain(int argc, char *argv[]) * poll/select call, so this also limits speed of response to SIGQUIT, * which is more important.) * - * We use poll(2) if available, otherwise select(2) + * We use poll(2) if available, otherwise select(2). + * Win32 has its own implementation. */ +#ifndef WIN32 #ifdef HAVE_POLL input_fd.fd = pgStatSock; input_fd.events = POLLIN | POLLERR; @@ -1810,6 +1814,10 @@ PgstatCollectorMain(int argc, char *argv[]) got_data = FD_ISSET(pgStatSock, &rfds); #endif /* HAVE_POLL */ +#else /* WIN32 */ + got_data = pgwin32_waitforsinglesocket(pgStatSock, FD_READ, + PGSTAT_SELECT_TIMEOUT*1000); +#endif /* * If there is a message on the socket, read it and check for |
