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.92) (envelope-from ) id 1jDavL-0004xV-97 for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 21:35:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDavK-00066l-2K for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 21:35:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jDavI-00066e-6f for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 21:35:53 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jDav9-0004Gl-Gc for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 21:35:51 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1EE0A21A97; Sun, 15 Mar 2020 17:35:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 15 Mar 2020 17:35:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=I Qkix46jS/glVS548+/GfO4M4LJQ9J/h7UzW9ZLE2wU=; b=ugaNOs8jD+iIfEcXZ YyUoobRrEkvjy1CYsdd5z+Tqzk+Wu98N6eqUgo0tLVdB1JlrGBOASffNqYg2TfIg 8yzxj3sS664JBp+W6Q6sTxMjtjT16eEF3cVeqjj8GTztKTD+MBfNt4hKN58WJsp7 3e6hBOZd4uZUqjaBGQYu3HwprRU3K0wkWzurxOhYW7uWcqf66HWCcEV+BlqG0ako QCIyL93/8J7nbdeGS1P9UZXoFZbELz7ekSSZenU6E7agjRO5SVfz0ll2JuI08erU yARSn/lRTjU39UpMNUk9x8ulci1DNuN1TfN8DArhberGYyzev3OLY8hIudBK/uuI tiS6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=IQkix46jS/glVS548+/GfO4M4LJQ9J/h7UzW9ZLE2 wU=; b=azV4LV4YUP4x9kQxd7VA9JS2pTuTfu9w65S97553Dz6581lVXBeXdkM03 xklQmtrG7xv77ypDKatVrwLPpu1MfE8XKAgibSkl/zWmSwyV3/vHZ+RglYEKYSzK /d7kMZ3R4t1FdloXcGvFT5z3k67PBmyM4YQJr0RowWrIhQKO+HI7tYw4DtLme1on 8J5Gj5RQBxmeLTV8uftIimzRZD26mk4sBKRCJRS/S0VinuNrgyYPpdQ/pkrMmG67 RFkqui6VIiLZIFE7apLJW1nmFIu7Y75RWEMVoL+sUCi1b/e8ZLkzNaZGwY++O1Cu 038MjqhqfmZ19QLixZYfcMrCuTq6Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefuddgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepuggrthgrsggrshgvshhouhhprdgtohhmpdhpohhsthhgrhgv shhqlhdrohhrghenucfkphepjedurddvuddvrdduvdelrdduleefnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgv rhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 4D57730614FA; Sun, 15 Mar 2020 17:35:40 -0400 (EDT) Subject: Re: unexpected chunk number 2 (expected 0) for toast value ... in pg_toast_18536 To: Karsten Hilbert , pgsql-general@lists.postgresql.org References: <20200315182349.GL467@hermes.hilbert.loc> <20200315192037.GM467@hermes.hilbert.loc> <3b7214bd-d0b5-e66f-fd29-240f1eb56cdf@aklaver.com> <20200315202100.GO467@hermes.hilbert.loc> From: Adrian Klaver Message-ID: <537b5f42-efb7-6833-3c10-d2cf7cd05496@aklaver.com> Date: Sun, 15 Mar 2020 14:35:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200315202100.GO467@hermes.hilbert.loc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/15/20 1:21 PM, Karsten Hilbert wrote: > On Sun, Mar 15, 2020 at 12:58:53PM -0700, Adrian Klaver wrote: > >>>> We then tried to DELETE the offending row >>>> >>>> delete from blobs.doc_obj where pk = 82224; >>>> >>>> but that, again, shows the "unexpected chunk" problem. >>> >>> According to >>> >>> http://www.databasesoup.com/2013/10/de-corrupting-toast-tables.html >>> >>> an UPDATE of the row is recommended -- should that work >>> better than a DELETE ? >>> >>> I can't find documentation pointing to a fundamental >>> implementation difference that suggests so. >> >> https://www.postgresql.org/docs/12/storage-toast.html#STORAGE-TOAST-ONDISK >> >> "During an UPDATE operation, values of unchanged fields are normally >> preserved as-is; so an UPDATE of a row with out-of-line values incurs no >> TOAST costs if none of the out-of-line values change." > > However, where is the fault in my thinking ? > > -> An UPDATE actually *would* change the TOASTed BYTEA field (which is corrupt). > > I had hoped that the DELETE would NOT have to touch the TOAST > table at all (and thereby not check the chunks) as "all it > needs to do" is mark the row in the *primary* table as > not-needed-anymore. > > I must be misunderstanding something. Except it would also need to delete the toast entries as well. > > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B > > -- Adrian Klaver adrian.klaver@aklaver.com