Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfEGn-000652-LL for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Jun 2019 01:59:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hfEGk-0005xc-SQ for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Jun 2019 01:59:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfEGi-0005xV-Gu for pgsql-bugs@lists.postgresql.org; Mon, 24 Jun 2019 01:59:42 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfEGf-0000bd-0Z for pgsql-bugs@lists.postgresql.org; Mon, 24 Jun 2019 01:59:39 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8D94622054; Sun, 23 Jun 2019 21:59:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 23 Jun 2019 21:59:35 -0400 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=fm2; bh=XYr7QHoEBJ41+b+szJ+4ISGnhxQ ChArjZ01rvBnpvV4=; b=Vi2TI+fgUs/XS0NjqIPBpRWYlNw5X+40AC3RI8E+a/t s5KcFOizxoFS8dDp4NRRXN2nCPgSyOF+xVd9FMkGTf0F//sUz3p5BnztR72P2ADN F7O3n50y2YLhob0H5Z4m/HBTYt69yfxUp3PoTC3LYRxldpVhohGWH9B2n8HrktF/ uSxckFGwkj4vYDBJW3mPwian7ZwgQ3ufGe9akMPlhJLBsChFv4nwgAWEcPJR7elh Cy1rSG6Jv1VoR84kvCiViPFVgLBzT9I198QT2b6l3eUXC7zaxDJltxf4sZYu2eCv bHkh5VMPHdhrL7T5Zw3ZLMgADqX+BbBrEIR5GQAVIMw== 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=fm3; bh=XYr7QH oEBJ41+b+szJ+4ISGnhxQChArjZ01rvBnpvV4=; b=eQ1tRl89ZqCrzyxa7BY8ph 20JMTjtdiP5eKdj+jq756o/pkdHZBJJZLXQNaPyhEwv8MCKcHpAtPNCi3kXtQBS9 juksVSwkop3bb4Vq2d+RvwU2Gn6SO41gazV1TT5RKcgYVXEabCJihxWy9Ss3+n9C sGkY0vKu3VDGLAeQFYie1SPZNM1fu/FOg42MGKk3sZ1jHLK6HCa0z0SIauBLEx9O EEAOoUtOwe0FIUA/9o6q7dtdfAfX8X7B5hW/Z69d1sYbShqsZj0phG9G/JNFuK3q 4Vpa5TsXs+c9+qajpNBoauY/CiuSsIgV25vXE3hG0+d2zL3o8gGoQI6IR3zEhryA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddruddugdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttdej necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecukfhppeduuddurddutddvrddukedtrddukeehnecurfgrrhgr mhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluh hsthgvrhfuihiivgeptd 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 940788005A; Sun, 23 Jun 2019 21:59:32 -0400 (EDT) Date: Mon, 24 Jun 2019 10:59:20 +0900 From: Michael Paquier To: Andrey Borodin Cc: Alvaro Herrera , pgsql-bugs@lists.postgresql.org, =?utf-8?B?0JDQvdC90LAg0JrRgNGF0LDQvdCx0LDRgNC+0LLQsA==?= , Dmitriy Sarafannikov Subject: Re: Logging corruption error codes Message-ID: <20190624015920.GA1637@paquier.xyz> References: <20190620170945.GA21117@alvherre.pgsql> <28DE958A-DB3B-4266-B960-596B0092FF8E@yandex-team.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline In-Reply-To: <28DE958A-DB3B-4266-B960-596B0092FF8E@yandex-team.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 21, 2019 at 03:22:15PM +0500, Andrey Borodin wrote: > 20 =D0=B8=D1=8E=D0=BD=D1=8F 2019 =D0=B3., =D0=B2 22:09, Alvaro Herrera =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): >> This is not totally insane -- other similar messages such as 'corrupted >> page pointers' in bufpage.c get the same errcode. > > On master there is only > elog(ERROR, "incorrect index offsets supplied"); > in bufpage.c. But this indicate misuse, not corrupted data on disk. > Others already use ERRCODE_DATA_CORRUPTED. Yeah. We may be able to expand the use of ERRCODE_DATA_CORRUPTED a bit more in the area. No objections against that. >> I would like to have a separate marking for messages indicating a >> system-level permanent problem rather than user error ("table/column X >> does not exist"), retryable condition ("serializability violation"), or >> resource exhaustion ("out of memory", "too many clients"), > > Good idea, but there must be standards to which we comply? I am not completely sure what you are going at here? Are you aiming at creating more wrappers which are errno-specific, like errcode_for_file_access() and such? There is a set of categories in errcodes.txt which make a rather clear classification of the different types of failures which can happen: - Corruption cases are part of the "cannot happen" case. - Serializable functions are related to transactionability. - OOM is system-related. - Too many clients is a Postgres-specific limitation. So these look rather clear to me. > I believe we should not report hardware problems as corruption. But > this worries us (YC) too. Do you think that this problem deserve a > patch? The difference may not be easy here. Postgres has no idea if the problem comes from the FS, the kernel or the hardware itself. We just report the problem that the OS tells us about so I don't think that we should try to be smarter than the OS telling us something. elog() points to an internal error which should never happen. By that, it seems to me that we should use elog() for cases where some code paths should never be logically reached. Now, there is no hard line here, sometimes we finish by using elog() on purpose as a sanity check if for example catalog data gets corrupted (you cannot use an assertion if you rely on an on-page state, obviously), so improving things with a case-by-case approach is fine in my opinion.. > If we introduce new error code - this is, kind of, new > feature. Should I send it to pgsql-hackers? Yes, I don't think that new error codes would gain a back-patch. So discussing that on -hackers would be more adapted in my opinion. Looking at the patch you propose, I don't have an argument against applying what you propose FWIW. These suggestions seem sensible. But that's not really a bug as the code works properly even without your changes. Note: the indentation of the patch is incorrect everywhere. A committer applying your patch would apply pgindent anyway. :) -- Michael --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl0QLngACgkQnvQgOdby QH3CKRAAn45e+tJvkUe2WXHLmKf7IuToPXTVslUuRlwDIzln3iaEwV5nRMdw/stU c9a7hfbHUkyHJ63J4wQz3foV2Y41RpPj0rLv0tgw6TWUKrWjY3slVTe8go4Ktl6A IJv+7p3iOtrMgwIouoexx0AWPnmUgUv/aUqoL8CUH7Xr2hoLP3wMHDiX2k53IKyf R/oUnW/cnicdwg6rQ7R4SbVin+87HcTeD5XYyw5w5guBsfr5YvkfXLH1HuSj1UNj 17PrK9I77VkqPyVYzy1zuM9izvMKDSy2CzFYEZFGBtC+aRB2jwIyXoWKo10BGdwv 5Gdo+hJAoiq1z2LJNi7Qf7L8HxLDFHbZCAoxi7FfVclzJavToMMfF5pqM3TqatHC EzlBKE2/akY/NQFWkRc800DN4PGIIMHk4D/ffbmJp5XB4D+9AVwSklgnkJ31xPps mcW8UAYXF+36RDAEEfJtPhM7C0aPZVXocyW420BOtkrTnbuu3FPBCwsR45HNe5hv d3j4fJo8k0QCrwslvzMwBc94E9H5+Fzl1T+uGylGIIfeiqwgQryXTQ5rR87RRWTJ ZKyMLVn7nnaMWGL7ZyGnipveEQFarpJZYH0dQfMIHXCS3PMbeVPrfiBJrORdPcbM 2Bt8k6IrQH/gCIYZaWXuXtHvx/Y+xRTNH9ZK8goJp+owqVx3xXA= =z63y -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM--