Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TgIS8-0002yt-9G for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2012 17:08:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TgIS7-0002Ri-An for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2012 17:08:07 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TgIS6-0002Rd-Mo for pgsql-bugs@postgresql.org; Wed, 05 Dec 2012 17:08:06 +0000 Received: from moutng.kundenserver.de ([212.227.17.10]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TgIS4-0005jR-Sw for pgsql-bugs@postgresql.org; Wed, 05 Dec 2012 17:08:06 +0000 Received: from anarazel.de (p5DDC4F13.dip.t-dialin.net [93.220.79.19]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MWcMY-1Thoam3hj0-00XgX0; Wed, 05 Dec 2012 18:08:03 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 0C4A31C00E6; Wed, 5 Dec 2012 18:08:01 +0100 (CET) Date: Wed, 5 Dec 2012 18:08:01 +0100 From: Andres Freund To: Tom Lane Cc: Simon Riggs , Jeff Janes , Heikki Linnakangas , Noah Misch , Pg Bugs Subject: Re: PITR potentially broken in 9.2 Message-ID: <20121205170801.GA27424@awork2.anarazel.de> References: <20516.1354666844@sss.pgh.pa.us> <20121205021537.GB9811@awork2.anarazel.de> <22653.1354674454@sss.pgh.pa.us> <20121205143314.GA6420@awork2.anarazel.de> <6461.1354723883@sss.pgh.pa.us> <20121205162421.GB20456@awork2.anarazel.de> <7015.1354725616@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7015.1354725616@sss.pgh.pa.us> X-Provags-ID: V02:K0:5kq17T0pEnQYs56ClEQs0FyWrvckKYAz/4DyaMUNIIH 4r+g0M5qmHAmERktKZHZPnnaypw+83YP7j0Ixjg4vtV+DbNaR/ 6bxM8v7XrTfqV/Fnjdj9bnCBxrRMQEKMqyBy3WpmH64U1mnq3F dECI3+9JIfbLerG87lXE2fn++FmHanOjSpWV8SvDkfZe2VYCID JGzetyn2sIBY7pIVgJoLZjBNgqOWkwgOJEkjf+6B7Bu0ohbB+W rNG2dOzb5ekoCbPPXRz6Kt1AQkI/PPKeG2Olg4RQ+QdcALoBPH H0LEFmodmI9kFxYEBiYTPqJt92mW2TszXwN9oj3td9vO3ricN/ DkoX9huRHfT1TikmLi9B6jE4Qq0CbaRP7vUa0r65a X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2012-12-05 11:40:16 -0500, Tom Lane wrote: > Andres Freund writes: > > Basically the whole logical arround recoveryApply seems to be broken > > currently. Because if recoveryApply=false we currently don't pause at > > all because we jump out of the apply loop with the break. > > Huh? That break is after the pause: > > /* > * Have we reached our recovery target? > */ > if (recoveryStopsHere(record, &recoveryApply)) > { > /* > * Pause only if users can connect to send a resume > * message > */ > if (recoveryPauseAtTarget && standbyState == STANDBY_SNAPSHOT_READY) > { > SetRecoveryPause(true); > recoveryPausesHere(); > } > reachedStopPoint = true; /* see below */ > recoveryContinue = false; > if (!recoveryApply) > break; > } Oh, yea. I mixed what I read in the patch and what exists today in my mind, sorry for that. But it still seems rather strange that we break out of the loop depending on recovery_target_inclusive which is what recoveryApply basically is set to. We do: ereport(LOG, (errmsg("recovery has paused"), errhint("Execute pg_xlog_replay_resume() to continue."))); if we reach the target, so jumping out of the loop seems really counter intuitive to me. > The point of recoveryApply is that the stop can be defined as occurring > either before or after the current WAL record. However, I do see your > point, which is that if the stop is defined to be after the current WAL > record then we probably should apply same before pausing. Otherwise > the pause is a bit useless since the user can't see the state he's being > asked to approve. Yes. Seems easy enough if we do the SetRecoveryPause() up there and just fall through to the pause later in the loop. > The real question here probably needs to be "what is the point of > recoveryPauseAtTarget in the first place?". I find it hard to envision > what's the point of pausing unless the user has an opportunity to > make a decision about whether to continue applying WAL. You can do SELECT pg_xlog_replay_pause|resume(); but that obviously sucks without further support... > As Simon > mentioned, we seem to be lacking some infrastructure that would let > the user adjust the recovery_target parameters before resuming WAL > processing. But, assuming for the moment that our workaround for > that is "shutdown the server, adjust recovery.conf, and restart", > is the pause placed in a useful spot for that? I actually think Simon's proposed pause location makes more sense if thats the only mode we support, but if so it probably should be the one for inclusive/non-inclusive replay. > BTW, could we make this more convenient by letting recoveryPausesHere() > reread recovery.conf? Also, shouldn't the code re-evaluate > recoveryStopsHere() after that? At least it seems like something we could do without introducing more functions (i.e. possibly back-branch fit). Given that pauses are controlled via sql functions setting the target also via an sql functions seems kinda fitting otherwise. Greetings, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs