pgstat_drop_relation bugfix

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: pgstat_drop_relation bugfix
Date: 2007-06-26 11:19:22
Message-ID: 20070626195741.6A3D.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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 Content-Type Size
pgstat_drop_relation.patch application/octet-stream 12.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-06-26 11:43:53 Re: [HACKERS] msvc and vista fun
Previous Message Fabien COELHO 2007-06-26 11:11:41 Re: Frustrating issue with PGXS

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2007-06-26 11:43:53 Re: [HACKERS] msvc and vista fun
Previous Message Heikki Linnakangas 2007-06-26 08:28:58 Re: Load Distributed Checkpoints, take 3