Re: Location for pgstat.stat - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Location for pgstat.stat
Date
Msg-id 10918.1215008881@sss.pgh.pa.us
Whole thread Raw
In response to Re: Location for pgstat.stat  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Location for pgstat.stat  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.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


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: PATCH: CITEXT 2.0
Next
From: Alvaro Herrera
Date:
Subject: Re: WIP patch: reducing overhead for repeat de-TOASTing