|
13 | 13 | *
|
14 | 14 | *Copyright (c) 2001-2010, PostgreSQL Global Development Group
|
15 | 15 | *
|
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 $ |
17 | 17 | * ----------
|
18 | 18 | */
|
19 | 19 | #include"postgres.h"
|
@@ -3288,15 +3288,24 @@ pgstat_write_statsfile(bool permanent)
|
3288 | 3288 | last_statwrite=globalStats.stats_timestamp;
|
3289 | 3289 |
|
3290 | 3290 | /*
|
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. |
3296 | 3295 | */
|
3297 | 3296 | if (last_statrequest>last_statwrite)
|
3298 | 3297 | {
|
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 | + |
3300 | 3309 | last_statrequest=last_statwrite;
|
3301 | 3310 | }
|
3302 | 3311 | }
|
|