pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby
Date: Wed, 4 Nov 2015 11:33:51 +0100
Message-ID: <20151104103351.GB29170@awork2.anarazel.de> (raw)
In-Reply-To: <CAB7nPqRB7OU4N7B0otR3BY+pQ0PU5w9QxUy6D_q4YXiAXiB=OQ@mail.gmail.com>
References: <20151016203031.3019.72930@wrigleys.postgresql.org>
	<CAB7nPqS-joTOdjqBUYGdawVcOw5UwrMZf+vOdzzbgHtDBg6SRg@mail.gmail.com>
	<20151102055841.2561.61366.pgcf@coridan.postgresql.org>
	<CA+TgmoZm1ecn8Qv1Hv0wTmJJJE0QobrWVE4bpBdpca_BJkW4Ww@mail.gmail.com>
	<20151103154300.GY11897@awork2.anarazel.de>
	<CAB7nPqSA9=n+GumHRjp-OJs4J8ScNn1cSV5xmw7mr3EGs9+Ydg@mail.gmail.com>
	<741137DB-35AF-450B-9746-7FE55A8729C3@anarazel.de>
	<CAB7nPqRB7OU4N7B0otR3BY+pQ0PU5w9QxUy6D_q4YXiAXiB=OQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2015-11-04 16:01:28 +0900, Michael Paquier wrote:
> On Wed, Nov 4, 2015 at 8:39 AM, Andres Freund <andres@anarazel.de> wrote:
> > On November 4, 2015 12:37:02 AM GMT+01:00, Michael Paquier wrote:
> >>On a completely idle system, I don't think we should log any standby
> >>records. This is what ~9.3 does.
> >
> > Are you sure? I think it'll around checkpoints, no? I thought Heikki had fixed that, but looking sound that doesn't seem to be the case.
> 
> Er, yes, sorry. I should have used clearer words: I meant idle system
> with something running nothing including internal checkpoints.

Uh, but you'll always have checkpoints happen on wal_level =
hot_standby, even in 9.3?  Maybe I'm not parsing your sentence right.

As soon as a single checkpoint ever happened the early-return logic in
CreateCheckPoint() will fail to take the LogStandbySnapshot() in
CreateCheckPoint() into account. The test is:
    if (curInsert == ControlFile->checkPoint +
	MAXALIGN(SizeOfXLogRecord + sizeof(CheckPoint)) &&
	ControlFile->checkPoint == ControlFile->checkPointCopy.redo)
which obviously doesn't work if there's been a WAL record logged after
the redo pointer has been determined etc.

The reason that a single checkpoint is needed to "jumpstart" the
pointless checkpoints is that otherwise we'll never have issued a
LogStandbySnapshot() and thus the above code block works if we started
from a proper shutdown checkpoint.


Independent of the idle issue, it seems to me that the location of the
LogStandbySnapshot() is actually rather suboptimal - it really should
really be before the CheckPointGuts(), not afterwards. As closer it's to
the redo pointer of the checkpoint a hot standby node starts up from,
the sooner that node can reach consistency.  There's no difference for
the first time a node starts from a basebackup (since we gotta replay
that checkpoint anyway before we're consistent), but if we start from a
restartpoint...

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (87+ messages)  latest in thread

Message-ID: <20151104103351.GB29170@awork2.anarazel.de>
Permalink:  ../20151104103351.GB29170@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20151104103351.GB29170@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, michael.paquier@gmail.com, robertmhaas@gmail.com, jeff.janes@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby
  In-Reply-To: <20151104103351.GB29170@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox