Re: Location for pgstat.stat

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Location for pgstat.stat
Date: 2008-07-02 14:28:01
Message-ID: 10918.1215008881@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Tom Lane wrote:
>> It doesn't seem to me that it'd be hard to support two locations for the
>> stats file --- it'd just take another parameter to the read and write
>> routines. pgstat.c already knows the difference between a normal write
>> and a shutdown write ...

> Right. Should it be removed from the permanent location when the server
> starts?

Yes, I would say so. There are two possible exit paths: normal shutdown
(where we'd write a new file) and crash. In a crash we'd wish to delete
the file anyway for fear that it's corrupted.

Startup: read permanent file, then delete it.

Post-crash: remove any permanent file (same as now)

Shutdown: write permanent file.

Normal stats collector write: write temp file.

Backend stats fetch: read temp file.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberts, Jon 2008-07-02 14:36:44 Re: pg crashing
Previous Message Magnus Hagander 2008-07-02 14:17:36 Re: pg crashing