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

Commit 223f82d

Browse files
committed
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.
1 parent 23244d6 commit 223f82d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
1515
*
16-
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.202 2010/03/12 22:19:19 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.203 2010/03/24 16:07:10 tgl Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -3288,15 +3288,24 @@ pgstat_write_statsfile(bool permanent)
32883288
last_statwrite = globalStats.stats_timestamp;
32893289

32903290
/*
3291-
* It's not entirely clear whether there could be clock skew between
3292-
* backends and the collector; but just in case someone manages to
3293-
* send us a stats request time that's in the future, reset it.
3294-
* This ensures that no inquiry message can cause more than one stats
3295-
* file write to occur.
3291+
* If there is clock skew between backends and the collector, we
3292+
* could receive a stats request time that's in the future. If so,
3293+
* complain and reset last_statrequest. Resetting ensures that no
3294+
* inquiry message can cause more than one stats file write to occur.
32963295
*/
32973296
if (last_statrequest > last_statwrite)
32983297
{
3299-
elog(LOG, "last_statrequest is in the future, resetting");
3298+
char *reqtime;
3299+
char *mytime;
3300+
3301+
/* Copy because timestamptz_to_str returns a static buffer */
3302+
reqtime = pstrdup(timestamptz_to_str(last_statrequest));
3303+
mytime = pstrdup(timestamptz_to_str(last_statwrite));
3304+
elog(LOG, "last_statrequest %s is later than collector's time %s",
3305+
reqtime, mytime);
3306+
pfree(reqtime);
3307+
pfree(mytime);
3308+
33003309
last_statrequest = last_statwrite;
33013310
}
33023311
}

0 commit comments

Comments
 (0)