Re: Shared WAL archive between master and standby: WALs not always identical

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Sasa Vilic <sasavilic(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Shared WAL archive between master and standby: WALs not always identical
Date: 2017-03-01 00:15:49
Message-ID: 6d6331f8-cd91-820f-7656-4ee4fb74f3ef@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/28/2017 02:20 PM, Sasa Vilic wrote:
> On 2017-02-28 16:41, Adrian Klaver wrote:
>> Seems to mean the simpler thing to do would be to set standby to
>> archive_mode = on, in which case the standby would not contribute WAL's
>> until it was promoted which would seem to be what you want.
>
> Yes, that was my first thought. Except that documentation states following:
>
> """
> If archive_mode is set to on, the archiver is not enabled during
> recovery or standby mode. If the standby server is promoted, it will
> start archiving after the promotion, *but will not archive any WAL it
> did not generate itself*
> """
>
> What happens with WAL that are started on primary but finished on
> secondary?

I thought that was covered in your scenario?:

"
5. Primary server crashes, i.e. due to catastrophic disk failure
- everything stops and can't be recovered
- wal archiver is dead, but even if it were alive it wouldn't send
WAL to archive anyway because 16MB of wal segment was not filled up
6. We promote our secondary server to master
- In secondary server's WAL we already got changes from primary
- Secondary continues appending new changes to wal segment
7. Eventually WAL segment on secondary fills up and then pushes it to
wal archive.
"

So the WAL that is sent to the archive by the standby is the one it
generated from the records it got via streaming replication from the master.

>
> Regards,
> Sasa
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jong-won Choi 2017-03-01 01:31:12 array_to_json - dealing with returning no rows
Previous Message Paul Jungwirth 2017-02-28 22:59:15 Re: json aggregation question