diff -rpcd orig/src/backend/postmaster/pgstat.c new/src/backend/postmaster/pgstat.c *** orig/src/backend/postmaster/pgstat.c 2013-06-25 03:55:41.000000000 +0900 --- new/src/backend/postmaster/pgstat.c 2013-07-08 16:32:44.000000000 +0900 *************** done: *** 4121,4127 **** */ static bool pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent, ! TimestampTz *ts) { PgStat_StatDBEntry dbentry; PgStat_GlobalStats myGlobalStats; --- 4121,4127 ---- */ static bool pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent, ! TimestampTz *ts, int elevel) { PgStat_StatDBEntry dbentry; PgStat_GlobalStats myGlobalStats; *************** pgstat_read_db_statsfile_timestamp(Oid d *** 4136,4142 **** if ((fpin = AllocateFile(statfile, PG_BINARY_R)) == NULL) { if (errno != ENOENT) ! ereport(pgStatRunningInCollector ? LOG : WARNING, (errcode_for_file_access(), errmsg("could not open statistics file \"%s\": %m", statfile))); --- 4136,4142 ---- if ((fpin = AllocateFile(statfile, PG_BINARY_R)) == NULL) { if (errno != ENOENT) ! ereport(elevel, (errcode_for_file_access(), errmsg("could not open statistics file \"%s\": %m", statfile))); *************** pgstat_read_db_statsfile_timestamp(Oid d *** 4149,4155 **** if (fread(&format_id, 1, sizeof(format_id), fpin) != sizeof(format_id) || format_id != PGSTAT_FILE_FORMAT_ID) { ! ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); FreeFile(fpin); return false; --- 4149,4155 ---- if (fread(&format_id, 1, sizeof(format_id), fpin) != sizeof(format_id) || format_id != PGSTAT_FILE_FORMAT_ID) { ! ereport(elevel, (errmsg("corrupted statistics file \"%s\"", statfile))); FreeFile(fpin); return false; *************** pgstat_read_db_statsfile_timestamp(Oid d *** 4161,4167 **** if (fread(&myGlobalStats, 1, sizeof(myGlobalStats), fpin) != sizeof(myGlobalStats)) { ! ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); FreeFile(fpin); return false; --- 4161,4167 ---- if (fread(&myGlobalStats, 1, sizeof(myGlobalStats), fpin) != sizeof(myGlobalStats)) { ! ereport(elevel, (errmsg("corrupted statistics file \"%s\"", statfile))); FreeFile(fpin); return false; *************** pgstat_read_db_statsfile_timestamp(Oid d *** 4186,4192 **** if (fread(&dbentry, 1, offsetof(PgStat_StatDBEntry, tables), fpin) != offsetof(PgStat_StatDBEntry, tables)) { ! ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); goto done; --- 4186,4192 ---- if (fread(&dbentry, 1, offsetof(PgStat_StatDBEntry, tables), fpin) != offsetof(PgStat_StatDBEntry, tables)) { ! ereport(elevel, (errmsg("corrupted statistics file \"%s\"", statfile))); goto done; *************** pgstat_read_db_statsfile_timestamp(Oid d *** 4208,4214 **** goto done; default: ! ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); goto done; --- 4208,4214 ---- goto done; default: ! ereport(elevel, (errmsg("corrupted statistics file \"%s\"", statfile))); goto done; *************** backend_read_statsfile(void) *** 4231,4236 **** --- 4231,4237 ---- TimestampTz min_ts = 0; TimestampTz ref_ts = 0; int count; + int elevel = WARNING; /* already read it? */ if (pgStatDBHash) *************** backend_read_statsfile(void) *** 4250,4256 **** CHECK_FOR_INTERRUPTS(); ! ok = pgstat_read_db_statsfile_timestamp(MyDatabaseId, false, &file_ts); cur_ts = GetCurrentTimestamp(); /* Calculate min acceptable timestamp, if we didn't already */ --- 4251,4257 ---- CHECK_FOR_INTERRUPTS(); ! ok = pgstat_read_db_statsfile_timestamp(MyDatabaseId, false, &file_ts, elevel); cur_ts = GetCurrentTimestamp(); /* Calculate min acceptable timestamp, if we didn't already */ *************** backend_read_statsfile(void) *** 4317,4322 **** --- 4318,4327 ---- if (ok && file_ts >= min_ts) break; + /* Avoid swamping the server log file with failure messages */ + if (!ok) + elevel = DEBUG2; + /* Not there or too old, so kick the collector and wait a bit */ if ((count % PGSTAT_INQ_LOOP_COUNT) == 0) pgstat_send_inquiry(cur_ts, min_ts, MyDatabaseId);