Skip to content

Commit 4243f23

Browse files
committed
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.
1 parent bee34e9 commit 4243f23

File tree

1 file changed

+9
-3
lines changed
  • src/backend/storage/smgr

1 file changed

+9
-3
lines changed

src/backend/storage/smgr/smgr.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.97 2006/03/24 04:32:13 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.98 2006/03/30 22:11:55 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -470,8 +470,14 @@ smgr_internal_unlink(RelFileNode rnode, int which, bool isTemp, bool isRedo)
470470
*/
471471
FreeSpaceMapForgetRel(&rnode);
472472

473-
/* Tell the stats collector to forget it immediately, too. */
474-
pgstat_drop_relation(rnode.relNode);
473+
/*
474+
* Tell the stats collector to forget it immediately, too. Skip this
475+
* in recovery mode, since the stats collector likely isn't running
476+
* (and if it is, pgstat.c will get confused because we aren't a real
477+
* backend process).
478+
*/
479+
if (!InRecovery)
480+
pgstat_drop_relation(rnode.relNode);
475481

476482
/*
477483
* And delete the physical files.

0 commit comments

Comments
 (0)