Re: Proposed doc-patch: Identifying the Current WAL file - Mailing list pgsql-docs

From Tom Lane
Subject Re: Proposed doc-patch: Identifying the Current WAL file
Date
Msg-id 9932.1145030835@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposed doc-patch: Identifying the Current WAL file  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Proposed doc-patch: Identifying the Current WAL file
List pgsql-docs
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Richard Huxton wrote:
>> To identify the current, partially-filled WAL segment, sort first by
>> mtime and second by file name. That is, take the latest mtime among the
>> properly-named files, breaking ties by taking the higher filename.

> I am confused by this.  Why do both mtime and file name need to be
> checked?

Because recycled WAL segments are renamed to have higher file names than
the currently-in-use segment.  So you can't depend on file name first.
However, shortly after a segment switch two WAL segments could have the
same mtime (to within whatever the mtime granularity is, typ. 1 second).

The proposed rule should be OK as long as checkpoints (and ensuing
renames) can't occur oftener than the mtime granularity.  If you're
checkpointing more than once a second, well, you need help ...

            regards, tom lane

pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Proposed doc-patch: Identifying the Current WAL file
Next
From: Bruce Momjian
Date:
Subject: Re: Proposed doc-patch: Identifying the Current WAL file