aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-03-24 16:07:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-03-24 16:07:10 +0000
commit223f82d4da528b61b50ea2cae142b7e14584bca3 (patch)
tree2de3ae1250323a0824f1c2f8e40da12a8978fa47
parent23244d6f24766a6435455a069cad43e4e9201572 (diff)
downloadpostgresql-223f82d4da528b61b50ea2cae142b7e14584bca3.tar.gz
postgresql-223f82d4da528b61b50ea2cae142b7e14584bca3.zip
Now that we know last_statrequest > last_statwrite can be observed in the
buildfarm, expend a little more effort on the log message for it.
-rw-r--r--src/backend/postmaster/pgstat.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index c00b87c8f37..5c3d700d290 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.202 2010/03/12 22:19:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.203 2010/03/24 16:07:10 tgl Exp $
* ----------
*/
#include "postgres.h"
@@ -3288,15 +3288,24 @@ pgstat_write_statsfile(bool permanent)
last_statwrite = globalStats.stats_timestamp;
/*
- * It's not entirely clear whether there could be clock skew between
- * backends and the collector; but just in case someone manages to
- * send us a stats request time that's in the future, reset it.
- * This ensures that no inquiry message can cause more than one stats
- * file write to occur.
+ * If there is clock skew between backends and the collector, we
+ * could receive a stats request time that's in the future. If so,
+ * complain and reset last_statrequest. Resetting ensures that no
+ * inquiry message can cause more than one stats file write to occur.
*/
if (last_statrequest > last_statwrite)
{
- elog(LOG, "last_statrequest is in the future, resetting");
+ char *reqtime;
+ char *mytime;
+
+ /* Copy because timestamptz_to_str returns a static buffer */
+ reqtime = pstrdup(timestamptz_to_str(last_statrequest));
+ mytime = pstrdup(timestamptz_to_str(last_statwrite));
+ elog(LOG, "last_statrequest %s is later than collector's time %s",
+ reqtime, mytime);
+ pfree(reqtime);
+ pfree(mytime);
+
last_statrequest = last_statwrite;
}
}