Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5E49-0007zN-Oz for pgsql-hackers@arkaria.postgresql.org; Mon, 01 May 2017 16:20:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d5E49-0003oX-6y for pgsql-hackers@arkaria.postgresql.org; Mon, 01 May 2017 16:20:49 +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 1d5E2d-000111-EQ for pgsql-hackers@postgresql.org; Mon, 01 May 2017 16:19:15 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d5E2a-0004lq-OD for pgsql-hackers@postgresql.org; Mon, 01 May 2017 16:19:14 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C7121206D5; Mon, 1 May 2017 12:19:11 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Mon, 01 May 2017 12:19:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=SRv46gP5QgwCckB1gE eMAJJz0Sokk/RuyPFvehybqW0=; b=XLIdHQf0s7QKB7m2zEaZE//VuX6KghAMsq sEtr10ooWKLQyzSWFkMjg47TM2sA9m13buD2bE37wllF3fKgWifnpHY6HFPGhMkn j1N9M1uFWzG4iRpieO89iEpvzLilOowWA7794wrRZSaRryNmAxe7QzpFOzYyTPby BGXvV0nBo3+VUw5271zgE2jntjF5ebYPOeUFi2ImjJ4/vr2YWbPYw3GP2d8mI+du GW/Yun85Dz/9BrM3op/C2XevptiOI70XzoKUur29emiRbCHSFdY3s9+nsmcqCpoy ydZ08/8Vj4N8TK4yCwJ2j6ObSjdt79GefFy5an58+Ytarsv5FRPA== X-ME-Sender: X-Sasl-enc: PJ6AMckdbYuliR1zLBsfxsPKPJYtwSRL2gMz33uy6LcQ 1493655551 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 6B27D7E1BE; Mon, 1 May 2017 12:19:11 -0400 (EDT) Subject: pg_ctl wait exit code (was Re: [COMMITTERS] pgsql: Additional tests for subtransactions in recovery) To: Michael Paquier , Simon Riggs References: Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Mon, 1 May 2017 12:19:10 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------349D1A70CFB5C44F4898F78E" X-Pg-Spam-Score: -2.6 (--) 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 This is a multi-part message in MIME format. --------------349D1A70CFB5C44F4898F78E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 4/27/17 08:41, Michael Paquier wrote: > +$node_slave->promote; > +$node_slave->poll_query_until('postgres', > + "SELECT NOT pg_is_in_recovery()") > + or die "Timed out while waiting for promotion of standby"; > > This reminds me that we should really switch PostgresNode::promote to > use the wait mode of pg_ctl promote, and remove all those polling > queries... I was going to say: This should all be obsolete already, because pg_ctl promote waits by default. However: Failure to complete promotion within the waiting time does not lead to an error exit, so you will not get a failure if the promotion does not finish. This is probably a mistake. Looking around pg_ctl, I found that this was handled seemingly inconsistently in do_start(), but do_stop() errors when it does not complete. Possible patches for this attached. Perhaps we need a separate exit code in pg_ctl to distinguish general errors from did not finish within timeout? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------349D1A70CFB5C44F4898F78E Content-Type: invalid/octet-stream; name="0001-pg_ctl-Make-failure-to-complete-operation-a-nonzero-.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-pg_ctl-Make-failure-to-complete-operation-a-nonzero-.pa"; filename*1="tch"