Re: WAL segment management on a standby

From: John Scalia <jayknowsunix(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: WAL segment management on a standby
Date: 2014-07-14 13:57:00
Message-ID: 53C3E1AC.60704@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Craig, I didn't know about pg_archivecleanup. (it's hard to figure out every utility when you're not given the time to thoroughly study the system.)

I altered the recovery.conf per the suggestion on the documentation page for it. It does seem a little aggresive, but I'm guessing that because all the transactions have been
recorded from the streaming walreceiver. If I might, I'd like to ask one final question on this matter. In looking through the standby after configuring this and restarting the
system, the log file shows a few warnings.

First, it whined about no history.0000004 file, which as the last WAL segment is 0000000030000000E00000004E, I'm guessing the standby thought the timeline might have been changed,
but it was not. Then, it complained about no history.00000003 file in the archive area. This file had already been copied up into pg_xlog and deleted from the archive. Finally, the
last complaint was that it couldn't find 0000000030000000E00000004F in the archive. It appears that under streaming a standby server will write concurrently with the primary any
WAL segment the primary is still generating. I say this as that missing WAL segment ("...4F") was already in the pg_xlog directory, but it hadn't yet made it into the archive area.
Eventually, 10 minutes later, 4F did appear in the archive. Is my interpretation here correct, that a standby will concurrently write a WAL segment in streaming replication mode?

I just want to be able to explain this thoroughly to my QA folks.
--
Jay

On 7/13/2014 10:18 PM, Craig Ringer wrote:
> On 07/12/2014 12:49 AM, John Scalia wrote:
>> Again, thanks to all to have assisted me with getting the WAL segments
>> to both my standby servers. Everything with that is now working quite
>> well. I do have a related followup question, however. On these standby's
>> nothing is built in to manage those WAL segments in the archive
>> directory. Thus, that directory can grow to the point where it fills up
>> the disk rather quickly. Any good strategies for dealing with the WAL
>> segments that get put in there. Do I really need them after postgresql
>> has copied them up into the pg_xlog directory? If so, how far back
>> should I keep them? Yes, I know about keeping everything between
>> backups. So, if my directory looks like:
>>
>> 00000000300000000C000000A1
>> 00000000300000000C000000A2
>> 00000000300000000C000000A3
>> 00000000300000000C000000A3.backup
>> 00000000300000000C000000A4
>>
>> Could I safely delete the *A1, *A2, and maybe even the *A3 files?
> Take a look at the pg_archivecleanup tool.
>
> You might also want to look at PgBarman to automate this.
>
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Guillaume Lelarge 2014-07-14 21:05:07 Re: 答复: [ADMIN] sql to grant privilege on sequence
Previous Message liuyuanyuan 2014-07-14 09:31:01 答复: [ADMIN] sql to grant privilege on sequence