Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1abFge-0001QR-LU for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Mar 2016 22:56:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1abFge-0001PF-8D for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Mar 2016 22:56:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1abFgd-0001P4-ON for pgsql-bugs@postgresql.org; Wed, 02 Mar 2016 22:56:07 +0000 Received: from mimolette.dalibo.net ([212.85.157.144]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1abFga-0001qz-E7 for pgsql-bugs@postgresql.org; Wed, 02 Mar 2016 22:56:07 +0000 Received: from [192.168.0.4] (aur75-1-78-192-238-147.fbxo.proxad.net [78.192.238.147]) by mimolette.dalibo.net (Postfix) with ESMTPSA id E0DB61F1092E; Wed, 2 Mar 2016 23:55:30 +0100 (CET) Subject: Re: BUG #13770: Extending recovery_min_apply_delay on Standby causes it to be unavailable for a while To: Michael Paquier , Tom Lane References: <20151111155006.2644.84564@wrigleys.postgresql.org> <20151230140218.5jqkq3rjoejlrgq7@alap3.anarazel.de> <11507.1451489748@sss.pgh.pa.us> Cc: Andres Freund , Greg Clough , PostgreSQL mailing lists , Simon Riggs , Robert Haas From: Julien Rouhaud Message-ID: <56D76F61.5060504@dalibo.com> Date: Wed, 2 Mar 2016 23:55:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 02/01/2016 13:14, Michael Paquier wrote: > On Thu, Dec 31, 2015 at 8:13 AM, Michael Paquier > wrote: >> On Thu, Dec 31, 2015 at 12:35 AM, Tom Lane wrote: >>> Andres Freund writes: >>>> On 2015-12-26 22:45:57 +0900, Michael Paquier wrote: >>>>> Depending on the use cases, it may be interesting to have a switch >>>>> allowing to not apply the delay should a consistent point not be >>>>> reached though... >>> >>>> Is there actually any case where it's interesting to delay in that >>>> scenario? I mean that really can only happen if you changed the >>>> configuration to a different delay, or your clock offset >>>> changed. Otherwise we should always reach the consistent point before >>>> the delay plays a role. I'm tempted to simply only check for delay when >>>> consistent. >>> >>> The argument for having a delay at all is to allow backing up to some >>> earlier point in the master's history; but a slave that is not yet >>> consistent cannot provide any rollback/recovery option. The slave is >>> completely useless for any purpose until it reaches consistency, so >>> it might as well do that as fast as possible, and then sit on the >>> next WAL record until the delay is met. +1 for no delay at all when >>> not consistent. >> >> OK, I don't mind doing so if you guys think that's more adapted. Based >> on reading the code, it seems obvious though that this was made so as >> a delay is taken into account even before the node is consistent. > > Changing my mind after more thoughts on the matter, it seems indeed > that it would make more sense to apply delays only once the database > has reached a consistent state to be able to do immediately > transaction-related operations on a standby without having to wait for > it to reach consistency for perhaps a couple of hours. Please see > attached a patch to do that. > > I just reviewed the patch. It's pretty straightforward and works as intended, so I mark it as ready for committer. -- Julien Rouhaud http://dalibo.com - http://dalibo.org -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs