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 1oHkoi-0002Xe-2y for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Jul 2022 11:39:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oHkog-00045J-NG for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Jul 2022 11:39:34 +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 1oHkof-00042K-MI for pgsql-hackers@lists.postgresql.org; Sat, 30 Jul 2022 11:39:34 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oHkoc-0000md-6B for pgsql-hackers@postgresql.org; Sat, 30 Jul 2022 11:39:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id A2B2E320055E; Sat, 30 Jul 2022 07:39:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 30 Jul 2022 07:39:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1659181166; x=1659267566; bh=d fuiuXoxQMg/ZK6r/6wzA750M+4PNWdCpKAUSWULmus=; b=nGnKwv8Uwz6t+Tm+d BCcnuP0sJLG6GxpYTMylFAKGduF2BEHYB/1z+Zf8j7UgaAFw9bJ3vKvfBIMhObai 1FoG8fY3KhgSAaBw5hn58fXW3rcjNZiaPKhYCbozA2OfzW1nnQxzj4cC2czylgd8 PaYthNaqceAlUl7KZJ3XJoWMNEVymd1l5p7rFXTF6C2IgF6h2mmuwkjAUy1ym0Rx bOUhKl2jwobtownjHeEjLS+PT24dEYSxzWuCE7/xJgmcHq2qj7LBxzyMIl4eeV/m F8zoW/ui65C0kEk+d1ZyuGcf4Xldths+BGMqXrEKbNQAKWwAlTc1+24GcW/0ySdu BIk8w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdduledggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 30 Jul 2022 07:39:25 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 09AFA376; Sat, 30 Jul 2022 13:39:22 +0200 (CEST) Date: Sat, 30 Jul 2022 13:39:22 +0200 From: Alvaro Herrera To: Dilip Kumar Cc: Robert Haas , Andres Freund , Heikki Linnakangas , Thomas Munro , pgsql-hackers , vignesh C Subject: Re: making relfilenodes 56 bits Message-ID: <20220730113922.qd7qmenwcmzyacje@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jul-30, Dilip Kumar wrote: > On Thu, Jul 28, 2022 at 9:29 PM Alvaro Herrera wrote: > > Please don't do this; rather use %llu and cast to (long long). > > Otherwise the string becomes mangled for translation. > > Okay, actually I did not understand the clear logic of when to use > %llu and to use (U)INT64_FORMAT. They are both used for 64-bit > integers. So do you think it is fine to replace all INT64_FORMAT in > my patch with %llu? The point here is that there are two users of the source code: one is the compiler, and the other is gettext, which extracts the string for the translation catalog. The compiler is OK with UINT64_FORMAT, of course (because the preprocessor deals with it). But gettext is quite stupid and doesn't understand that UINT64_FORMAT expands to some specifier, so it truncates the string at the double quote sign just before; in other words, it just doesn't work. So whenever you have a string that ends up in a translation catalog, you must not use UINT64_FORMAT or any other preprocessor macro; it has to be a straight specifier in the format string. We have found that the most convenient notation is to use %llu in the string and cast the argument to (unsigned long long), so our convention is to use that. For strings that do not end up in a translation catalog, there's no reason to use %llu-and-cast; UINT64_FORMAT is okay. > > > @@ -2378,7 +2378,7 @@ verifyBackupPageConsistency(XLogReaderState *record) > > > if (memcmp(replay_image_masked, primary_image_masked, BLCKSZ) != 0) > > > { > > > elog(FATAL, > > > - "inconsistent page found, rel %u/%u/%u, forknum %u, blkno %u", > > > + "inconsistent page found, rel %u/%u/" INT64_FORMAT ", forknum %u, blkno %u", > > > rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, > > > forknum, blkno); > > > > Should this one be an ereport, and thus you do need to change it to that > > and handle it like that? > > Okay, so you mean irrespective of this patch should this be converted > to ereport? Yes, I think this should be an ereport with errcode(ERRCODE_DATA_CORRUPTED). -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/