Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPawd-0007uI-OY for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jun 2017 20:49:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dPawd-00042w-8C for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jun 2017 20:49:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dPawb-00041Q-KN for pgsql-hackers@postgresql.org; Mon, 26 Jun 2017 20:49:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dPawY-00050O-CH for pgsql-hackers@postgresql.org; Mon, 26 Jun 2017 20:49:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v5QKn7GS019813; Mon, 26 Jun 2017 16:49:07 -0400 From: Tom Lane To: Andres Freund cc: Jeff Janes , Michael Paquier , PostgreSQL mailing lists Subject: Re: Reducing pg_ctl's reaction time In-reply-to: <20170626203347.6efkdwiadyt33edy@alap3.anarazel.de> References: <18444.1498428798@sss.pgh.pa.us> <24992.1498504537@sss.pgh.pa.us> <18520.1498508356@sss.pgh.pa.us> <20170626202356.qybnpn5li2ke4ioc@alap3.anarazel.de> <18890.1498508760@sss.pgh.pa.us> <20170626203347.6efkdwiadyt33edy@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 26 Jun 2017 13:33:47 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19811.1498510147.1@sss.pgh.pa.us> Date: Mon, 26 Jun 2017 16:49:07 -0400 Message-ID: <19812.1498510147@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > Arguably we could and should improve the logic when the server has > started, right now it's pretty messy because we never treat a standby as > up if hot_standby is disabled... True. If you could tell the difference between "HS disabled" and "HS not enabled yet" from pg_control, that would make pg_ctl's behavior with cold-standby servers much cleaner. Maybe it *is* worth messing with the contents of pg_control at this late hour. My inclination for the least invasive fix is to leave the DBState enum alone and add a separate hot-standby state field with three values (disabled/not-yet-enabled/enabled). Then pg_ctl would start probing the postmaster when it saw either DB_IN_PRODUCTION DBstate or hot-standby-enabled. (It'd almost not have to probe the postmaster at all, except there's a race condition that the startup process will probably change the field a little before the postmaster gets the word to open the gates.) On the other hand, if it saw DB_IN_ARCHIVE_RECOVERY with hot standby disabled, it'd stop waiting. Any objections to that design sketch? Do we need to distinguish between master and slave servers in the when-to-stop-waiting logic? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers