Re: Skip checkpoint on promoting from streaming replication

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, masao(dot)fujii(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Skip checkpoint on promoting from streaming replication
Date: 2013-01-25 12:15:12
Message-ID: 51027750.5070307@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24.01.2013 19:44, Simon Riggs wrote:
> On 24 January 2013 16:52, Heikki Linnakangas<hlinnakangas(at)vmware(dot)com> wrote:
>> I may be missing something, but it looks like after a "fast" promotion, you
>> don't request a new checkpoint. So it can take quite a while for the next
>> checkpoint to be triggered by checkpoint_timeout/segments. That shouldn't be
>> a problem, but I feel that it'd be prudent to request a new checkpoint
>> immediately (not necessarily an "immediate" checkpoint, though).
>
> I thought of that and there is a long comment to explain why I didn't.
>
> Two problems:
>
> 1) an immediate checkpoint can cause a disk/resource usage spike,
> which is definitely not what you need just when a spike of connections
> and new SQL hits the system.

It doesn't need to be an "immediate" checkpoint, ie. you don't need to
rush through it with checkpoint_completion_target=0. I think you should
initiate a regular, slow, checkpoint, right after writing the
end-of-recovery record. It can take some time for it to finish, which is ok.

There's no hard correctness reason here for any particular behavior, I
just feel that that would make most sense. It seems prudent to initiate
a checkpoint right after timeline switch, so that you get a new
checkpoint on the new timeline fairly soon - it could take up to
checkpoint_timeout otherwise, but there's no terrible rush to finish it
ASAP.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-01-25 12:25:35 Re: Visual Studio 2012 RC
Previous Message Kohei KaiGai 2013-01-25 11:22:29 Re: [sepgsql 1/3] add name qualified creation label