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 1kjnrm-0000Jk-4E for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 18:25:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjnrl-0000bz-28 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 18:25:37 +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 1kjnrk-0000bs-R6 for pgsql-hackers@lists.postgresql.org; Mon, 30 Nov 2020 18:25:36 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjnri-0005ZW-LF for pgsql-hackers@postgresql.org; Mon, 30 Nov 2020 18:25:36 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 9F10BFA3; Mon, 30 Nov 2020 13:25:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 30 Nov 2020 13:25:32 -0500 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:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=LuCfhIKi2NqM8Bz+6 l9rdM4waRUPbmmjXQVGwMk/cY4=; b=OTKTyhhxkWrwXiCSrUtuhm3PVskN0aI3g yBrLUDHIapCvdTvwiYqWHHcd2c1A2Pwih/3QMOqOnXsWcFewT6A06bT7gN4ECNHs COfl7kyrL4oo5tvXpIRx2FzG/a+01VdZIJEL6YGajV67fUfbV+STFDrsCAoRghdp qmUEKTr/GaFY5UvXEHl1wkkax9piTbnrSblyWuiNcn+ywQ/FVxf3BqNg4d9BQg9F Hi6o9DMJZ9vuvN2OX/5VMpuyAUVdf1l5PMwzFxE3vZMpiEsPhk/VwJ3aNkCs/whP Jh83p+khOWpjlurY0ILrGGkZmwG6ru4QjZelLJ3z30AfuDrgSSYyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeitddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtuggjfgesthdtredttdervdenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvefgleevgeeujeeghfegteeghfegheeifeehheelteet ieduieeihffggfehffetnecukfhppeduledtrdelhedrudekrdejleenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 9A4E93064AAE; Mon, 30 Nov 2020 13:25:30 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 6EAED2A14FE; Mon, 30 Nov 2020 15:25:28 -0300 (-03) Date: Mon, 30 Nov 2020 15:25:28 -0300 From: Alvaro Herrera To: Fujii Masao Cc: Masahiko Sawada , "Drouvot, Bertrand" , Masahiko Sawada , Kyotaro Horiguchi , PostgreSQL-development Subject: Re: Add Information during standby recovery conflicts Message-ID: <20201130182528.GA1854@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Dec-01, Fujii Masao wrote: > + if (proc) > + { > + if (nprocs == 0) > + appendStringInfo(&buf, "%d", proc->pid); > + else > + appendStringInfo(&buf, ", %d", proc->pid); > + > + nprocs++; > > What happens if all the backends in wait_list have gone? In other words, > how should we handle the case where nprocs == 0 (i.e., nprocs has not been > incrmented at all)? This would very rarely happen, but can happen. > In this case, since buf.data is empty, at least there seems no need to log > the list of conflicting processes in detail message. Yes, I noticed this too; this can be simplified by changing the condition in the ereport() call to be "nprocs > 0" (rather than wait_list being null), otherwise not print the errdetail. (You could test buf.data or buf.len instead, but that seems uglier to me.)