Re: Immediate standby promotion

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Immediate standby promotion
Date: 2014-09-01 06:23:18
Message-ID: CAA4eK1+FRQP_UurDZSP0=dviZHGG7zcpUQP_TY==ZFE29MTiUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 14, 2014 at 1:49 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> Hi,
>
> I'd like to propose to add new option "--immediate" to pg_ctl promote.
> When this option is set, recovery ignores any WAL data which have not
> been replayed yet and exits immediately. Patch attached.
>
> This promotion is faster than normal one but can cause data loss.

I think there is one downside as well for this proposal that
apart from data loss, it can lead to uncommitted data occupying
space in database which needs to be later cleaned by vacuum.
This can happen with non-immediate promote as well, but the
chances with immediate are more. So the gain we got by doing
immediate promotion can lead to slow down of operations in some
cases. It might be useful if we mention this in docs.

Few comments about patch:

1.
On standby we will see below message:

LOG: received promote request

User will always see above message irrespective of whether it
is immediate promote or any other mode of promote. I think it will
be better to distinguish between different modes and display the
appropriate message.

2.
StartupXLOG()
{
..
+ if (immediate_promote)
+ break;
..
}

Why are you doing this check after pause
(recoveryApplyDelay/recoveryPausesHere) for recovery?

Why can't we do it after ReadRecord()?

3.
! * of "promote" and "immediate_promote"
shouldn't in above sentence 'or' is more appropriate?

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-09-01 08:00:32 Better support of exported snapshots with pg_dump
Previous Message Stephen Frost 2014-09-01 04:15:08 Re: RLS Design