postgresql/src/backend
Tom Lane b2355a29c6 Ensure that backends see up-to-date statistics for shared catalogs.
Ever since we split the statistics collector's reports into per-database
files (commit 187492b6c2), backends have been seeing stale statistics
for shared catalogs.  This is because the inquiry message only prompts the
collector to write the per-database file for the requesting backend's own
database.  Stats for shared catalogs are in a separate file for "DB 0",
which didn't get updated.

In normal operation this was partially masked by the fact that the
autovacuum launcher would send an inquiry message at least once per
autovacuum_naptime that asked for "DB 0"; so the shared-catalog stats would
never be more than a minute out of date.  However the problem becomes very
obvious with autovacuum disabled, as reported by Peter Eisentraut.

To fix, redefine the semantics of inquiry messages so that both the
specified DB and DB 0 will be dumped.  (This might seem a bit inefficient,
but we have no good way to know whether a backend's transaction will look
at shared-catalog stats, so we have to read both groups of stats whenever
we request stats.  Sending two inquiry messages would definitely not be
better.)

Back-patch to 9.3 where the bug was introduced.

Report: <56AD41AC.1030509@gmx.net>
2016-05-25 17:48:15 -04:00
..
access Fix bogus comments 2016-05-12 16:02:49 -03:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Fix assorted missing infrastructure for ON CONFLICT. 2016-05-11 16:20:03 -04:00
commands Fetch XIDs atomically during vac_truncate_clog(). 2016-05-24 15:47:51 -04:00
executor Fix latent crash in do_text_output_multiline(). 2016-05-23 14:16:40 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:19 -04:00
libpq Distrust external OpenSSL clients; clear err queue 2016-05-06 23:47:42 -04:00
main Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds 2016-03-10 14:10:32 +01:00
nodes Support IndexElem in raw_expression_tree_walker(). 2016-05-23 19:23:36 -04:00
optimizer Fix infer_arbiter_indexes() to not barf on system columns. 2016-05-11 17:06:53 -04:00
parser Fix unexpected side-effects of operator_precedence_warning. 2016-04-21 23:17:36 -04:00
po Translation updates 2016-05-09 10:05:46 -04:00
port Support building with Visual Studio 2015 2016-04-29 08:06:25 -04:00
postmaster Ensure that backends see up-to-date statistics for shared catalogs. 2016-05-25 17:48:15 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:11:52 -05:00
replication Remember asking for feedback during walsender shutdown. 2016-04-28 22:11:18 -07:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:44 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Introduce durable_rename() and durable_link_or_rename(). 2016-03-09 18:53:53 -08:00
tcop Message style improvements 2015-10-28 20:23:53 -04:00
tsearch Fix possible use of uninitialised value in ts_headline() 2016-04-08 21:25:32 +03:00
utils Fix assorted missing infrastructure for ON CONFLICT. 2016-05-11 16:20:03 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00