Re: replication recovery/startup question - Mailing list pgsql-admin

From Greg Smith
Subject Re: replication recovery/startup question
Date
Msg-id 4FF32066.5070000@2ndQuadrant.com
Whole thread Raw
In response to replication recovery/startup question  (Rob Cowell <Rob.Cowell@transversal.com>)
List pgsql-admin
On 06/25/2012 11:40 AM, Rob Cowell wrote:
> Why would the output from ‘ls’ show older filenames (0....1....3D...xx)
> as newer in date than the “0....1....3F...xx” filenames?
>
> Does Postgres re-cycle old log filenames ?

It recycles old log files.  If you turn on log_checkpoints, you can see
how many and how often.  It will list a count of recycled WAL files at
each checkpoint, along with how many of the old ones were just deleted
instead.

The weird pattern in the timestamps you're seeing is a state in the
middle of doing that, and yes they look quite weird sometimes.  The
files are noteed as reusable, get re-initialized to hold new data
(they're not overwritten completely with zeros like new WAL files are),
and renamed to a new segment number.  And each of those steps has a
corresponding flush to disk step which makes sure the filesystem
metadata is updated.  Some of the middle states there are unusual.

> Does the output from ‘ps’ mean the master/slave are in sync, or is the
> slave really still playing catchup (based on the names of the logfiles
> in pg_xlog) ?

Your example was in sync, with the file names just being odd due to the
implementation of WAL file recycling.  You might also check
pg_stat_replication to get an easier view of things, rather than relying
on ps.  ps is correct, it's just harder to check.


--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com

pgsql-admin by date:

Previous
From: Raghavendra
Date:
Subject: Re: Duplicate Index Creation
Next
From: Samuel Stearns
Date:
Subject: Re: Duplicate Index Creation