From: Tom Lane Date: Thu, 30 Mar 2006 22:11:59 +0000 (+0000) Subject: Suppress attempts to report dropped tables to the stats collector from a X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2dbd18fa484674e7a19e4163bea2eaddf3ebd9ea;p=users%2Fbernd%2Fpostgres.git Suppress attempts to report dropped tables to the stats collector from a startup or recovery process. Since such a process isn't a real backend, pgstat.c gets confused. This accounts for recent reports of strange "invalid server process ID -1" log messages during crash recovery. There isn't any point in attempting to make the report, since we'll discard stats in such scenarios anyhow. --- diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index f268ac89b2..eeef511719 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -470,8 +470,14 @@ smgr_internal_unlink(RelFileNode rnode, int which, bool isTemp, bool isRedo) */ FreeSpaceMapForgetRel(&rnode); - /* Tell the stats collector to forget it immediately, too. */ - pgstat_drop_relation(rnode.relNode); + /* + * Tell the stats collector to forget it immediately, too. Skip this + * in recovery mode, since the stats collector likely isn't running + * (and if it is, pgstats.c will get confused because we aren't a real + * backend process). + */ + if (!InRecovery) + pgstat_drop_relation(rnode.relNode); /* * And delete the physical files.