Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5O9P-00019Z-K5 for pgsql-general@arkaria.postgresql.org; Fri, 29 Jan 2021 07:25:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l5O9N-0000Hm-Lx for pgsql-general@arkaria.postgresql.org; Fri, 29 Jan 2021 07:25:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5O9N-0000HQ-EA for pgsql-general@lists.postgresql.org; Fri, 29 Jan 2021 07:25:01 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5O9L-0002S6-3r for pgsql-general@lists.postgresql.org; Fri, 29 Jan 2021 07:25:00 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A0B345C01BD; Fri, 29 Jan 2021 02:24:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 29 Jan 2021 02:24:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=eLWDnQ8ZLizom+i/yq+BeMoVb6Q nN9j2oN2j6ArGtj8=; b=MiUCufYHsWp6ZdwZVOXt+bdU3hs8A2VLF+ec9cEw13X lyDBBJc2sL/qJBKreH8rQ4zQ7S3tev5XEBdRrC+Lk6MDjNqz+YDmKQAbuHauLaBH LJ5nm3YvtGeU0NZt7kr5V7qY8dyflA4FLGRITOlYUNx6h0PppqJQvd55ANQJXYRw sPACmn594V0pGdh6/cvQMTLz8zW2AHRWjyG4ky507QFxXVFFItg0z6qNgnyX3E26 ATuO7TUsOBpRASmxdN8X6LCaP3mLzBN7uwWa5uvnKvOwOHCnkvgYeU22RSSOqsat pOvRKrQpKHlyj7Lrtl7dCb9QL+vyt3/3/mM59NbMFKA== 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-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=eLWDnQ 8ZLizom+i/yq+BeMoVb6QnN9j2oN2j6ArGtj8=; b=U8Pc1rolF0gfoq/0EvPgyU d2WUk7WoRFQ9Hwnpnl2PpykhpDvURJg5l+BSe41dp0wySalVvXOhF+WBNFo4OWUK Yoiez2TdfV7WHxthDs0k0atTz/hqm8NEH5wAe3LXwasZerUoFHkalL5gEx3L9iIp VWkOJj/1PvFwifG7AGMVOb7tsjsuOKD1guRWsF1dPuiWqP5CWmrusDtuZtsbtIF3 vabpLqdxmKZkCaHkM9rUoovF+sUo7ZgweoN/UGUO4s7j9hSJ/4LrEIFuvO27LfEO 1YIoVonnzM874/pvKPTuZmFNPjIaLCeRv3xQakAb8cRhOoPntT5KwzwrqaMBwd+Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedugddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt udenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeevtdfgkeduudeuveetfeeggfej uddvtdetuefhleeuffeukeeihfejgfeigeduleenucfkphepudduuddruddtvddrudektd drudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 1926724005A; Fri, 29 Jan 2021 02:24:54 -0500 (EST) Date: Fri, 29 Jan 2021 16:24:51 +0900 From: Michael Paquier To: Paul =?iso-8859-1?Q?F=F6rster?= Cc: Tatsuo Ishii , pgsql-general@lists.postgresql.org Subject: Re: Does pg_ctl promote wait for pending WAL? Message-ID: References: <20210129.115120.719391117505612933.t-ishii@sraoss.co.jp> <9D64B243-F9F6-4041-8B68-EFA2771E0135@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oHL++uIfzL1A21Fp" Content-Disposition: inline In-Reply-To: <9D64B243-F9F6-4041-8B68-EFA2771E0135@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --oHL++uIfzL1A21Fp Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ishii-san, On Fri, Jan 29, 2021 at 07:59:26AM +0100, Paul F=F6rster wrote: > On 29. Jan, 2021, at 03:51, Tatsuo Ishii wrote: >>=20 >> Does anybody know whether a standby server waits for pending WAL >> records/files while promotion is requested? I assume that no data >> update is performed on the primary server while promotion. >>=20 >> I imagine that a standby server stops to replay WAL and promotes as >> soon as SIGUSR1 signal is received. To answer to your question based on the code, you can check for the code paths calling CheckForStandbyTrigger() in xlog.c when it comes to promotion detection in the WAL replay. In short, WaitForWALToBecomeAvailable() tells that after the promotion is=20 detected in the startup process, then recovery would still try to replay as much WAL as possible from the archives or pg_wal before a failover. Equally, from the docs: "Before failover, any WAL immediately available in the archive or in pg_wal will be restored, but no attempt is made to connect to the primary." -- Michael --oHL++uIfzL1A21Fp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmATuEMACgkQnvQgOdby QH0osw//ajdXDomCcXAARSVI/Jv9X7hJmqqGkUVgzgd2XgdWm/1JvY6phpvLDR0s rJmmmkisP8BCo+EePfxjVATcBAxi1Do8GSCQs2eLJ7ztj1MlbPhVAJ2QuiA7auC6 I8WQx/2PkRJfNsFtjgcXKn7sSFoX6RXw4oAh8kicklEhG8Bojq71i5jhJEslP1Dv F9KyY0/3UkjP02+YTKSX6XdGTyn+DudLI1KZs+kVXZS6QvsAx5J1u5Krowk0EE5J /uTXc9gQjbNJJpFlER3tZv8qpG0oLIm1tXUz3E2s/xZkbcNuD0H0kCrxDMXj+hJ5 Mq8L91tQeDS0qPydUa0WYW3cGcNeE01FI5Hmj0UGS70n+071xgm2DmoeX79dpI+K wJuRN8fM4/w8frV9PqmURr4RiPBrDOzrCKTgwu2GUnqTUdC3JgF6LTckLquZHoK4 1VdWuvVq+654QG/NsEgH9IAMh5R5/MV1xBSWXrYqufWBLuuwfxyZhvUnMjZ388x/ A/CPiImzynduYNEYuAYMGJP/GZyk0ZGRRItBAWmTZolXljWRIQyp4anWUaFAOcP5 2Dm//8tzw3fB/4Wvgmc2c63T10y685Dkg5pp8Cxta7/DryUBsx0G6Rela0rFfT4n +8dNsfvfAKAc5aoOiT88HAVD9i6H2R0uRXCCZHt6W3l72jdn8s4= =AYf2 -----END PGP SIGNATURE----- --oHL++uIfzL1A21Fp--