Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit be1cc69

Browse files
committed
Fix pg_autovacuum -s flag to handle values > 2000 by using sleep()
instead of pg_usleep. Backpatch to 8.0.X.
1 parent 7b3bf60 commit be1cc69

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

contrib/pg_autovacuum/pg_autovacuum.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Revisions by Christopher B. Browne, Liberty RMS
55
* Win32 Service code added by Dave Page
66
*
7-
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.32 2005/05/11 14:53:43 momjian Exp $
7+
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.33 2005/05/11 17:57:56 momjian Exp $
88
*/
99

1010
#include "postgres_fe.h"
@@ -1749,7 +1749,16 @@ VacuumLoop(int argc, char **argv)
17491749
fflush(LOGOUTPUT);
17501750
}
17511751

1752-
pg_usleep(sleep_secs * 1000000L); /* Larger Pause between outer loops */
1752+
/* Larger Pause between outer loops */
1753+
/*
1754+
* pg_usleep() is wrong here because its maximum is ~2000 seconds,
1755+
* and we don't need signal interruptability on Win32 here.
1756+
*/
1757+
#ifndef WIN32
1758+
sleep(sleep_secs); /* Unix sleep is seconds */
1759+
#else
1760+
sleep(sleep_secs * 1000); /* Win32 sleep() is milliseconds */
1761+
#endif
17531762

17541763
gettimeofday(&then, 0); /* Reset time counter */
17551764

0 commit comments

Comments
 (0)