Skip to content
Browse files

Limit values of archive_timeout, post_auth_delay, auth_delay.millisec…

…onds.

The previous definitions of these GUC variables allowed them to range
up to INT_MAX, but in point of fact the underlying code would suffer
overflows or other errors with large values.  Reduce the maximum values
to something that won't misbehave.  There's no apparent value in working
harder than this, since very large delays aren't sensible for any of
these.  (Note: the risk with archive_timeout is that if we're late
checking the state, the timestamp difference it's being compared to
might overflow.  So we need some amount of slop; the choice of INT_MAX/2
is arbitrary.)

Per followup investigation of bug #7670.  Although this isn't a very
significant fix, might as well back-patch.
  • Loading branch information...
1 parent d038966 commit b6e3798f3aa2747db145f25e03a8d34f2e5ec8c8 @tglsfdc tglsfdc committed Nov 18, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 contrib/auth_delay/auth_delay.c
  2. +2 −2 src/backend/utils/misc/guc.c
View
2 contrib/auth_delay/auth_delay.c
@@ -59,7 +59,7 @@ _PG_init(void)
NULL,
&auth_delay_milliseconds,
0,
- 0, INT_MAX,
+ 0, INT_MAX / 1000,
PGC_SIGHUP,
GUC_UNIT_MS,
NULL,
View
4 src/backend/utils/misc/guc.c
@@ -1466,7 +1466,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_UNIT_S
},
&XLogArchiveTimeout,
- 0, 0, INT_MAX,
+ 0, 0, INT_MAX / 2,
NULL, NULL, NULL
},
{
@@ -1476,7 +1476,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_NOT_IN_SAMPLE | GUC_UNIT_S
},
&PostAuthDelay,
- 0, 0, INT_MAX,
+ 0, 0, INT_MAX / 1000000,
NULL, NULL, NULL
},
{

0 comments on commit b6e3798

Please sign in to comment.
Something went wrong with that request. Please try again.