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 1lDylH-0003kg-3i for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Feb 2021 00:07:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lDykk-0000eA-Hs for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Feb 2021 00:07:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lDykj-0000ak-Kp for pgsql-bugs@lists.postgresql.org; Mon, 22 Feb 2021 00:07:06 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lDykh-00042B-77 for pgsql-bugs@lists.postgresql.org; Mon, 22 Feb 2021 00:07:04 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id D95935C00B8; Sun, 21 Feb 2021 19:07:01 -0500 (EST) Received: from imap21 ([10.202.2.71]) by compute2.internal (MEProxy); Sun, 21 Feb 2021 19:07:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm1; bh=g2GGglSnsJZqItJIGlXlDIjDtqJewMe GCipZUzoB+YU=; b=vaAThLOs+m1xnB1fZUndJIU5Cs0b8QWz+aX75h1vdVHNJIS zgS7nMoQz6q8WuD6yPFCrf9mEpntYYJljG7MF7Br60LJixd3u4tMQNoPovxuYYZ7 ESeM+VV2QR+dF5IqbjBG/O7eKCGMzR1lzJZ/bFmKZbMSSHUNSgX8X+kR0k4YcT61 bV62a2MCiKltT1EcBC+1z3roS4i/KypgzqPx5YB0gD3Df7xERNnLz6/JvLq9rpAH T3P4hxv6BW8olgpf60Io68YohoXiR6XJ/KubN7TbsXNgHXeASCWb1NQHM+QO3/sF HUa0F/O/coPEoJl2ux8XWe1z8yjv3dqSxJUillw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm2; bh=g2GGgl SnsJZqItJIGlXlDIjDtqJewMeGCipZUzoB+YU=; b=uPQpl5r6bOU7aLfhqNquIV j0X+5EVc0BijTbrXTUPejIzTyQOAevVAltL/bbnn3F/Wn1yPv+y2MuFgeRdt2lQB 1d/wcYhqeVLaVIV7AY0R7+BmNEae9KOE55Jki6/zgARIYYE4ZQVWCRiWX/4g3pLE IsVS0rIxJRwmMCfiQzrD0dGVaaTmEiwu/xoUvbZUfzu/X9/t5IZi8GCsAsLO/SBJ jstTw3y1B4XOE7Kb4mdqEt4IWooGQIA+lTLGVhBQALhyER3y+8XFt4uG+mdOyxc5 M0g7OuFZ6YJA3/tUnK8w8bbPtcVh+QjIKmSf7FotfrvH5T1FhLnxiEYi3OydReeg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkedvgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesrgdtre erreerjeenucfhrhhomhepfdfguhhlvghrucfvrghvvghirhgrfdcuoegvuhhlvghrsegv uhhlvghrthhordgtohhmqeenucggtffrrghtthgvrhhnpeeiieehfeefheeuheellefffe fgteejleeiveeikeeikeelffegffeutdeigeeltdenucffohhmrghinhepphhoshhtghhr vghsqhhlrdhorhhgpdgvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuhhlvghrsegvuhhlvghrthho rdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 810F951C005D; Sun, 21 Feb 2021 19:07:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a Mime-Version: 1.0 Message-Id: <0f654d04-5d07-4e75-b995-d2271466f125@www.fastmail.com> In-Reply-To: <16879-3673aa2e1562a38f@postgresql.org> References: <16879-3673aa2e1562a38f@postgresql.org> Date: Sun, 21 Feb 2021 21:06:27 -0300 From: "Euler Taveira" To: mahadevan@rapidloop.com, pgsql-bugs@lists.postgresql.org Subject: =?UTF-8?Q?Re:_BUG_#16879:_Delayed_standby_does_not_connect_to_primary_on?= =?UTF-8?Q?_startup?= Content-Type: multipart/alternative; boundary=b9b09e9eee5c40a3bad58bbdfcbd384c List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --b9b09e9eee5c40a3bad58bbdfcbd384c Content-Type: text/plain On Sun, Feb 21, 2021, at 6:39 AM, PG Bug reporting form wrote: > We have a customer who reported pg_last_wal_receive_lsn() returning NULL on > a delayed standby, and this is what the investigation led to. This is not a bug. It is working as documented. "If streaming replication is disabled, or if it has not yet started, the function returns NULL." [1] In this scenario, server was (re)started but it cannot streaming because of recovery_min_apply_delay setting, hence, the pg_last_wal_receive_lsn() returns NULL. When the standby applies the first transaction (after 1h), this function will return a non-NULL value. [1] https://www.postgresql.org/docs/13/functions-admin.html#FUNCTIONS-RECOVERY-CONTROL -- Euler Taveira EDB https://www.enterprisedb.com/ --b9b09e9eee5c40a3bad58bbdfcbd384c Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Sun, Feb 21,= 2021, at 6:39 AM, PG Bug reporting form wrote:
We have a customer who reported pg_= last_wal_receive_lsn() returning NULL on
a delayed standby= , and this is what the investigation led to.
= This is not a bug. It is working as documented.    &= nbsp;           &= nbsp;           &= nbsp;   
     &nb= sp;           &nb= sp;           &nb= sp;           &nb= sp;           &nb= sp;           &nb= sp;           &nb= sp;     
"If streaming replicatio= n is disabled, or if it has not yet started, the    =       
function returns NULL= ." [1]           =             =             =             =         

In this scenario, server was (re)started but it cannot streaming b= ecause of       
recove= ry_min_apply_delay setting, hence, the  pg_last_wal_receive_lsn() r= eturns
NULL. When the standby applies the first transactio= n (after 1h), this function 
will return a non-NULL v= alue.           &= nbsp;           &= nbsp;           &= nbsp;           &= nbsp;     
   &nbs= p;           &nbs= p;           &nbs= p;           &nbs= p;           &nbs= p;           &nbs= p;           &nbs= p;       


--
Euler Taveira

--b9b09e9eee5c40a3bad58bbdfcbd384c--