postgresql/src/backend
Tom Lane 9e18eacbdf Fix stats collector to recover nicely when system clock goes backwards.
Formerly, if the system clock went backwards, the stats collector would
fail to update the stats file any more until the clock reading again
exceeds whatever timestamp was last written into the stats file.  Such
glitches in the clock's behavior are not terribly unlikely on machines
not using NTP.  Such a scenario has been observed to cause regression test
failures in the buildfarm, and it could have bad effects on the behavior
of autovacuum, so it seems prudent to install some defenses.

We could directly detect the clock going backwards by adding
GetCurrentTimestamp calls in the stats collector's main loop, but that
would hurt performance on platforms where GetCurrentTimestamp is expensive.
To minimize the performance hit in normal cases, adopt a more complicated
scheme wherein backends check for clock skew when reading the stats file,
and if they see it, signal the stats collector by sending an extra stats
inquiry message.  The stats collector does an extra GetCurrentTimestamp
only when it receives an inquiry with an apparently out-of-order
timestamp.

To avoid unnecessary GetCurrentTimestamp calls, expand the inquiry messages
to carry the backend's current clock reading as well as its stats cutoff
time.  The latter, being intentionally slightly in-the-past, would trigger
more clock rechecks than we need if it were used for this purpose.

We might want to backpatch this change at some point, but let's let it
shake out in the buildfarm for awhile first.
2012-06-17 17:11:49 -04:00
..
access Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
bootstrap Remove misplaced sanity check from heap_create(). 2012-06-14 09:58:53 -04:00
catalog Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
commands Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
executor Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
foreign Add GetForeignColumnOptions() to foreign.c, and add some documentation. 2012-03-07 18:20:58 -05:00
lib Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
libpq Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
main Improve documentation of postgres -C option 2012-06-13 13:41:25 +03:00
nodes Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
optimizer Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
parser Deprecate use of GLOBAL and LOCAL in temp table creation. 2012-06-13 17:48:42 -04:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
postmaster Fix stats collector to recover nicely when system clock goes backwards. 2012-06-17 17:11:49 -04:00
regex Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
replication Prevent non-streaming replication connections from being selected sync slave 2012-06-11 15:17:38 +02:00
rewrite Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
snowball Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
storage Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tcop Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tsearch Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
utils Remove RELKIND_UNCATALOGED. 2012-06-14 09:47:30 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Fix incorrect make maintainer-clean rule. 2012-04-07 18:16:50 -04:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00