Re: clarification about standby promotion

From: Venkata B Nagothi <nag1010(at)gmail(dot)com>
To: Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: clarification about standby promotion
Date: 2017-02-08 23:41:15
Message-ID: CAEyp7J9XYYwoBPA07CG7EiuAS2R7Z3_fhWJijGUQmsc8DkE1FQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 9, 2017 at 4:53 AM, Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>
wrote:

> Hi,
>
>
> I would like to clarify something about standby promotion. From the
> sentence below. I understand that, during the promotion process, postgres
> will replay all the available wals (from the archive or pg_xlog).
>

Yes, that is correct.

> https://www.postgresql.org/docs/9.5/static/warm-standby.
> html#STREAMING-REPLICATION
>
> 25.2.2. Standby Server Operation
> ...
> Standby mode is exited and the server switches to normal operation when
> pg_ctl promote is run or a trigger file is found (trigger_file). Before
> failover, any WAL immediately available in the archive or in pg_xlog will
> be restored, but no attempt is made to connect to the master.
>
> I have seen several articles like this one (https://www.enterprisedb.com/
> switchoverswitchback-postgresql-93) where they say that
> pg_last_xlog_receive_location() and pg_last_xlog_replay_location() should
> be checked before promotion. I don't understand why since they will be
> replayed anyway. Did something changed since 9.3 about this ?
>

The above link is about improvements related to switch-over/switch-back
process from the version 9.3. What you are asking is about standby
promotion process. When the standby is promoted, as mentioned in the docs,
the standby server attempts to apply the available WAL during the promotion
process and will not attempt to connect to master. Which means, you would
not know if there are any pending WALs yet to be streamed from master or in
other words, standby may not know if the master is a-head. It is important
that you know the standby current position by executing the above mentioned
*xlog* functions. Hope i answered your question.

Regards,

Venkata B N
Database Consultant

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Güttler 2017-02-09 06:17:10 Re: PostgreSQL on eMMC - Corrupt file system
Previous Message PAWAN SHARMA 2017-02-08 20:36:08 LDAP configuration