pgstat_drop_relation bugfix - Mailing list pgsql-patches

From ITAGAKI Takahiro
Subject pgstat_drop_relation bugfix
Date
Msg-id 20070626195741.6A3D.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Whole thread Raw
Responses Re: pgstat_drop_relation bugfix  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
I wrote:
> > pgstat_drop_relation() is expecting relid (pg_class.oid) as the argument,
> > but we pass it relfilenode.
> I'm trying to fix the bug, because there is a possibility that some useless
> statistics data continue to occupy some parts of the statistics table.

Here is a patch to fix undropped entries in the runtime statistics table.
Now smgr records the relation oids and uses them to drop entries
corresponding the relations.

We could make stray entries easily using the following queries.
  CREATE TABLE test (i integer);
  INSERT INTO test VALUES(1);
  TRUNCATE test;
  DROP TABLE test;

Since we don't discard any of stat entries except pg_stat_reset(),
those useless entries would cause memory leaks, though it is very trivial.

I fell my fix is uncool; Let me know if there are any other better ways.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-patches by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Load Distributed Checkpoints, take 3
Next
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] msvc and vista fun