pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Phil Endecott <spam_from_pgsql_lists@chezphil.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: Replication failure, slave requesting old segments
Date: Sun, 12 Aug 2018 12:58:26 -0700
Message-ID: <fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com> (raw)
In-Reply-To: <1534101938762@dmwebmail.dmwebmail.chezphil.org>
References: <e89b76f9-f60a-a645-587f-00aeb3c68770@aklaver.com>
	<1534101938762@dmwebmail.dmwebmail.chezphil.org>

On 08/12/2018 12:25 PM, Phil Endecott wrote:
> Hi Adrian,
> 
> Adrian Klaver wrote:
>> On 08/11/2018 12:42 PM, Phil Endecott wrote:
>>> Hi Adrian,
>>>
>>> Adrian Klaver wrote:
>>>> Looks like the master recycled the WAL's while the slave could not 
>>>> connect.
>>>
>>> Yes but... why is that a problem?  The master is copying the WALs to
>>> the backup server using scp, where they remain forever.  The slave gets
>>
>> To me it looks like that did not happen:
>>
>> 2018-08-11 00:05:50.364 UTC [615] LOG:  restored log file 
>> "0000000100000007000000D0" from archive
>> scp: backup/postgresql/archivedir/0000000100000007000000D1: No such 
>> file or directory
>> 2018-08-11 00:05:51.325 UTC [7208] LOG:  started streaming WAL from 
>> primary at 7/D0000000 on timeline 1
>> 2018-08-11 00:05:51.325 UTC [7208] FATAL:  could not receive data from 
>> WAL stream: ERROR:  requested WAL segment 0000000100000007000000D0 has 
>> already been removed
>>
>> Above 0000000100000007000000D0 is gone/recycled on the master and the 
>> archived version does not seem to be complete as the streaming 
>> replication is trying to find it.
> 
> The files on the backup server were all 16 MB.

WAL files are created/recycled as 16 MB files, which is not the same as 
saying they are complete for the purposes of restoring. In other words 
you could be looking at a 16 MB file full of 0's.

> 
> 
>> Below you kick the master and it coughs up the files to the archive 
>> including *D0 and *D1 on up to *D4 and then the streaming picks using 
>> *D5.
> 
> When I kicked it, the master wrote D1 to D4 to the backup.  It did not
> change D0 (its modification time on the backup is from before the "kick").
> The slave re-read D0, again, as it had been doing throughout this period,
> and then read D1 to D4.

Well something happened because the slave could not get all the 
information it needed from the D0 in the archive and was trying to get 
it from the masters pg_xlog.

> 
> 
>> Best guess is the archiving did not work as expected during:
>>
>> "(During this time the master was also down for a shorter period.)"
> 
> Around the time the master was down, the WAL segment names were CB and CC.
> Files CD to CF were written between the master coming up and the slave
> coming up.  The slave had no trouble restoring those segments when it 
> started.
> The problematic segments D0 and D1 were the ones that were "current" 
> when the
> slave restarted, at which time the master was up consistently.
> 
> 
> Regards, Phil.
> 
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (25+ messages)  latest in thread

Message-ID: <fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com>
Permalink:  ../fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com/
Also on:    postgresql.org/message-id/fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, spam_from_pgsql_lists@chezphil.org
  Subject: Re: Replication failure, slave requesting old segments
  In-Reply-To: <fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com>
  References: <e89b76f9-f60a-a645-587f-00aeb3c68770@aklaver.com> <1534101938762@dmwebmail.dmwebmail.chezphil.org> <fbfd3891-06f2-0b3d-e346-fd61503e4a2e@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox