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 1kj49K-0005Cy-IG for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Nov 2020 17:36:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kj49J-00019W-13 for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Nov 2020 17:36:41 +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 1kj49I-00019O-6E for pgsql-hackers@lists.postgresql.org; Sat, 28 Nov 2020 17:36:40 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kj49A-0005bc-Vi for pgsql-hackers@postgresql.org; Sat, 28 Nov 2020 17:36:39 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 109285C00A6; Sat, 28 Nov 2020 12:36:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 28 Nov 2020 12:36:30 -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=KRqx+/t1fE/fDB9ft JPGOWxyI55viOq2BH7roNdf/uE=; b=owelehhVg6lHrWDzZIjKDesH9OeHPn1pj nfj/O5mSryphIgy6dJ6zPmDBrLrlXNwrcfRfl7XackFkhvVPrhSuDXIr2JWBW6Oc L5+Y6W6o8vSr5YOe/nptWOiJT3yBZryrmWmqKfGCXq1YnqX4WepWVTQeNsNPNgGq hB2au7WFcBaaZ/UnaAc1gaFUQ4xuUQMXLdfrhR6aLg7LA5iHeSVuTVeZRgh6O1wV 4E2a/ytabRjH3dKtdwGcGibF+tvj0iA7fBvaW7a4Ohm0rUezFUlYWZP4qSsvPqDu 6Lms9zrwdocNLYUvTY4SRQpHpXdXnjYf0yPG/Zcppc7O37oN8jKZQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudehiedguddthecutefuodetggdotefrod 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 E4F363064AAA; Sat, 28 Nov 2020 12:36:28 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8B3EF2A0FE6; Sat, 28 Nov 2020 14:36:26 -0300 (-03) Date: Sat, 28 Nov 2020 14:36:26 -0300 From: Alvaro Herrera To: "Drouvot, Bertrand" Cc: Masahiko Sawada , Fujii Masao , Masahiko Sawada , Kyotaro Horiguchi , PostgreSQL-development Subject: Re: Add Information during standby recovery conflicts Message-ID: <20201128173626.GA17184@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28e04235-27e4-0697-68df-001d2b75bee6@amazon.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Bertrand, On 2020-Nov-28, Drouvot, Bertrand wrote: > + if (nprocs > 0) > + { > + ereport(LOG, > + (errmsg("recovery still waiting after %ld.%03d ms: %s", > + msecs, usecs, _(get_recovery_conflict_desc(reason))), > + (errdetail_log_plural("Conflicting process: %s.", > + "Conflicting processes: %s.", > + nprocs, buf.data)))); > + } > + else > + { > + ereport(LOG, > + (errmsg("recovery still waiting after %ld.%03d ms: %s", > + msecs, usecs, _(get_recovery_conflict_desc(reason))))); > + } > + > + pfree(buf.data); > + } > + else > + ereport(LOG, > + (errmsg("recovery still waiting after %ld.%03d ms: %s", > + msecs, usecs, _(get_recovery_conflict_desc(reason))))); > +} Another trivial stylistic point is that you can collapse all these ereport calls into one, with something like ereport(LOG, errmsg("recovery still waiting after ...", opts), waitlist != NULL ? errdetail_log_plural("foo bar baz", opts) : 0); where the "waitlist" has been constructed beforehand, or is set to NULL if there's no process list. > + switch (reason) > + { > + case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN: > + reasonDesc = gettext_noop("for recovery conflict on buffer pin"); > + break; Pure bikeshedding after discussing this with my pillow: I think I'd get rid of the initial "for" in these messages.