Re: [BUG] Checkpointer on hot standby runs without looking checkpoint_segments

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: masao(dot)fujii(at)gmail(dot)com
Cc: heikki(dot)linnakangas(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUG] Checkpointer on hot standby runs without looking checkpoint_segments
Date: 2012-04-19 01:34:47
Message-ID: 20120419.103447.264987008.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I convinced that current patch has a problem, and will come up
with the new patch later.

====
> > I tried that at first. But I suppose the requirement here is 'if
> > reading segments comes via replication stream, enable throttling
> > by checkpoint_segments.' and WalRcvInProgress() seems fit to
> > check that.
>
> If so, what if replication is terminated and restarted repeatedly while
> a restartpoint is running? It sometimes obeys and sometimes ignores
> checkpoint_segments. Which seems strange behavior.

I see your point. And agree on that is something not should be.

> > Plus, adding SharedStartupStandbyMode into
> > XLogCtlData seems accompanied with some annoyances which would
> > not pay.
>
> Hmm... what are you worried about? I don't think that sharing the variable
> via XLogCtl is so difficult. Please see the code to share archiveCleanupCommand
> from the startup process to the checkpointer. It looks very simple.

The mechanism has nothing complex. I've been afraid of making so
many variables with similar meaning sitting side by side on
shared memory. But I convinced that additional shared variable is
preferable because it makes the logic and behavior clear and
sane.

I will come up with updated patch soon.

> > By the way, do you have some advise about GetStandbyFlushRecPtr()
> > and the order of the locations? I'm embarrassed with that...
>
> Sorry. I could not parse this.... Could you explain this again?

My point is,

- Is the assumption correct that "restorePtr <= replayPtr <= receivePtr"?

- If correct, what the code in GetStandbyFlushRecPtr() showing
below means?

> if (XLByteLT(receivePtr, replayPtr))

- Or if wrong, what situation would take place to break the
expression "restorePtr <= replayPtr <= receivePtr"?

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

== My e-mail address has been changed since Apr. 1, 2012.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2012-04-19 02:07:27 clarification for generate join implied equalities
Previous Message Peter Geoghegan 2012-04-19 01:31:59 Timsort performance, quicksort (was: Re: Memory usage during sorting)