Re: replication recovery/startup question

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: Rob Cowell <Rob(dot)Cowell(at)transversal(dot)com>
Cc: "'pgsql-admin(at)postgresql(dot)org'" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: replication recovery/startup question
Date: 2012-07-03 16:40:06
Message-ID: 4FF32066.5070000@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Samuel Stearns 2012-07-04 01:39:39 Re: Duplicate Index Creation
Previous Message Raghavendra 2012-07-03 15:15:37 Re: Duplicate Index Creation