Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhZ5H-00C9wv-CX for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Mar 2024 18:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rhZ5F-001M6j-DV for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Mar 2024 18:00:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhZ5F-001M6a-49 for pgsql-bugs@lists.postgresql.org; Tue, 05 Mar 2024 18:00:09 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rhZ5A-002w2s-6t for pgsql-bugs@lists.postgresql.org; Tue, 05 Mar 2024 18:00:08 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d33986dbc0so13218451fa.2 for ; Tue, 05 Mar 2024 10:00:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709661603; x=1710266403; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6Y7y1sU9y41x+P/LyHqkSv89n8NFi59HhMxOyu/xUlU=; b=cn/ISHsO+lYZUdLQQX5+/fPQowVuzo6ntfWMHf0XKOORx6KsfgEW01Y5AmTIXMVo82 +PzI8QW8uAGskRCALDG7dmoVINxLZc3Lz/dmscGyQeGtJfmuDlUPh17RmMq/jQnWVBiM 6aY60JZkRB5xlfNN8DUax6739SNBW+3OYIqSxDCS9m8ANLCsX60eLtZSvQkpW3CEn+ee FAUshfbU3gFSjT+lg4lNMQn7rwvBC6w1KsxDEVZ3CzahL8y2uBnMlEXYfUnIr+H4AjHT Uwylr9wTl7znOkI7FjKWuIRj9OmePIztFkpZ3YgIYR5rNTw2ZvvOwtUOJzga2hJPaLL9 CVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709661603; x=1710266403; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6Y7y1sU9y41x+P/LyHqkSv89n8NFi59HhMxOyu/xUlU=; b=Wd6yAFJtXyfe6dKDIc9ivhmNe1j8XkvSmwv/X3ZeCar8GHSCzQsVg6rhuKKkE/MJLO c9xrQCT9Dg/yhtFh+GURUlS1qionqQPbdZfn4LdLBeLYFcfSyM4zBgolXFHtSkrNgUVn rRPGpYVvKvyn0L7JMSzuPDhOS49OZkJcb8EC/2IzQpko3uOg/FaaBdi5trohQuauXrIm ooFI2XQddm71uq4VoDZlqp4R71eXT1TaxxDYQGaQ403RmF3mbyjWORpkWxp/y1c0RJvQ Gj0XeFgYTqNPBXBbZGbTxiezQseOlfVGXCDshKWh05xf1YZoTEla+vqQTtaiNhD4sNY4 L2wA== X-Gm-Message-State: AOJu0Yx+eh46OcW1rhQtSK0suh9hiL2zl367Q/72+6zLK28yx9yr8Zgy DD3ohKGTXwIoFCHQHCaH6crpnfVF1zBMYmR99NmrJCgyu89Rb2wmM6lA76ae X-Google-Smtp-Source: AGHT+IFrOuEaDGd+D4smF0nzT/XkgEyhmtOJbDaop6N84TxbZgGNjYsMrYhFJNhIxcGaS2NwhxKR3Q== X-Received: by 2002:a05:6512:a94:b0:513:57fe:97b1 with SMTP id m20-20020a0565120a9400b0051357fe97b1mr1407726lfu.41.1709661602493; Tue, 05 Mar 2024 10:00:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.30.186]) by smtp.gmail.com with ESMTPSA id h2-20020a0565123c8200b00512ea6c4944sm2250704lfv.282.2024.03.05.10.00.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Mar 2024 10:00:01 -0800 (PST) Message-ID: Date: Tue, 5 Mar 2024 21:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #18351: VACUUM FULL fails with error: missing chunk number 0 for toast value XXX Content-Language: en-US From: Alexander Lakhin To: pgsql-bugs@lists.postgresql.org References: <18351-f6e06364b3a2e669@postgresql.org> <80abbbf0-588b-f808-c264-77c3ebee83f3@gmail.com> In-Reply-To: <80abbbf0-588b-f808-c264-77c3ebee83f3@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 27.02.2024 12:00, Alexander Lakhin wrote: > 17.02.2024 23:00, PG Bug reporting form wrote: >> The following bug has been logged on the website: >> >> Bug reference:      18351 >> >> The following script: >> ... >> VACUUM tbl; >> VACUUM FULL tbl; >> " | psql -d db$c >psql-2-$c.log 2>&1 & >>    done >> wait >> grep 'missing chunk number' server.log  && break; >> done >> > I've discovered that not only VACUUM FULL can stumble over such missing toast values. CREATE INDEX behaves similarly, as the following script shows: for ((c=1;c<=20;c++)); do createdb db$c; done for ((i=1;i<=100;i++)); do echo "iteration $i"   for ((c=1;c<=20;c++)); do echo "\\d sometable" | psql -d db$c >psql-1-$c.log 2>&1 & echo "DROP TABLE IF EXISTS tbl; CREATE TABLE tbl (i int, t text); ALTER TABLE tbl ALTER COLUMN t SET STORAGE EXTERNAL; INSERT INTO tbl(i, t) VALUES (1, repeat('1234567890', 250)); DELETE FROM tbl; VACUUM (VERBOSE) tbl; CREATE INDEX t_idx ON tbl(t); " | psql -d db$c >psql-2-$c.log 2>&1 &   done wait grep 'missing chunk number' server.log  && break; done The backtrace of the heap_fetch_toast_slice() call emitting error is: 2024-03-05 17:41:07.786 UTC|law|db10|65e75933.208c6b|ERROR:  missing chunk number 0 for toast value 17314 in pg_toast_17289 2024-03-05 17:41:07.786 UTC|law|db10|65e75933.208c6b|BACKTRACE: heap_fetch_toast_slice at heaptoast.c:784:3 toast_fetch_datum at detoast.c:379:2 detoast_external_attr at detoast.c:54:12 index_form_tuple_context at indextuple.c:111:21 tuplesort_putindextuplevalues at tuplesortvariants.c:678:15 _bt_spool at nbtsort.c:537:1 _bt_build_callback at nbtsort.c:610:24 heapam_index_build_range_scan at heapam_handler.c:1329:22 table_index_build_scan at tableam.h:1781:9  (inlined by) _bt_spools_heapscan at nbtsort.c:483:15 btbuild at nbtsort.c:329:14 index_build at index.c:3042:10 index_create at index.c:1265:3 DefineIndex at indexcmds.c:1166:3 ... Best regards, Alexander