Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMD6V-0008Jf-7c for pgsql-general@arkaria.postgresql.org; Fri, 25 May 2018 13:49:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fMD6U-0005A3-2G for pgsql-general@arkaria.postgresql.org; Fri, 25 May 2018 13:49:58 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMD6T-00059t-Jk for pgsql-general@lists.postgresql.org; Fri, 25 May 2018 13:49:57 +0000 Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fMD6Q-000681-P9 for pgsql-general@postgresql.org; Fri, 25 May 2018 13:49:57 +0000 Received: by mail-io0-x22b.google.com with SMTP id d73-v6so6468775iog.3 for ; Fri, 25 May 2018 06:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/TQbDuteIRSo0/zkRW+URwKk1jOurxG80WH/YD2pqfw=; b=gYowApfSBH+i8LGZwzqvetx8S2YTb4YgGxd4T0b3J0sAqzWYFIdkTZiOwW5/LO0xVV pJEHIiAiKnSKbJzsGR06uYOvY5eAILWUSFxAJYbCv+CW4l+d+m+Yqy+qsPBjtjdoxDU4 YboPWMUXhVgvmxduS3ifYivTo9i3RtUDT1jeg/AEGx1Yu7efTYJGtfOMAu1dni387GIC Mf6nW83xK4RU0oS2EAAQSvgsIbYJ3unIcbdEQJT3OhyuUcoxb5ueTPdrs99dU5j56g9R VEzAPLy/JlXaNqE+/oHT04NtYmfeiKErpu5z8Mm0XdHglwcGxgyyiRD1yGnsx8z0hbX3 sTMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/TQbDuteIRSo0/zkRW+URwKk1jOurxG80WH/YD2pqfw=; b=U+toTtNYsgpmItEF49dEeSo4t43kfXTAUpnNOjMzwVJ6TO+ZCsIjnuT2Ggw6DRvWwr ROEKq1lqWd/bvUgZdDSzfQbdqk5EnZ57xYDwCwuR7upqqOTOIQi83jiogw6zlBn1MD56 XC+GXRdfcIM+zfZI3YVLBKd7r7ESu4en2S9Lbi2pnJUn6nJijWblwnSye0j4PPMPydwD c4psK/wbElkq1r32VuB5cU3bb1t1uEDrxgFvVenvXDcw/ootOaOp348+3T+ICExBW1UB NtNt47ssK0NBxtC9cGNB8o+1rcjZ+xxBtO4lRzT+h3JifkaEOJ+me+rV1Zl+kwToTPol /bIg== X-Gm-Message-State: ALKqPwd62lI/9t/rfoaL0H4U2DcymysvvRpnHpsGpH/DCLA5GO7P3vx2 UN7LLfJjXwOo8c6wbDxjoc19xFgOl5s= X-Google-Smtp-Source: ADUXVKIHaWxQtlZntzYytg9irNDpCgUbuxyM7kvOgHLelpmo+AZ6yAiIYBTYe1/dXPpNl8pFEp1J7w== X-Received: by 2002:a6b:1502:: with SMTP id 2-v6mr2221911iov.18.1527256191893; Fri, 25 May 2018 06:49:51 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id e189-v6sm12608674ioe.0.2018.05.25.06.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 06:49:51 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 6F2CB8019C8; Fri, 25 May 2018 08:49:50 -0500 (CDT) Date: Fri, 25 May 2018 08:49:50 -0500 From: Justin Pryzby To: Tom Lane Cc: pgsql-general@postgresql.org Subject: Re: postgres=# VACUUM FULL pg_statistic => ERROR: missing chunk number 0 for toast value .. in pg_toast_2619 Message-ID: <20180525134950.GX30060@telsasoft.com> References: <20180519142603.GA30060@telsasoft.com> <26735.1526742503@sss.pgh.pa.us> <20180519162457.GC30060@telsasoft.com> <20180519163528.GD30060@telsasoft.com> <25190.1526755166@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25190.1526755166@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, May 19, 2018 at 02:39:26PM -0400, Tom Lane wrote: > Justin Pryzby writes: > > [pryzbyj@database ~]$ while :; do for db in `psql postgres -Atc "SELECT datname FROM pg_database WHERE datallowconn"`; do for t in pg_statistic pg_attrdef pg_constraint; do echo "$db.$t..."; PGOPTIONS=-cstatement_timeout='9s' psql $db -qc "VACUUM FULL $t"; done; done; done > > > ... > > postgres.pg_statistic... > > postgres.pg_attrdef... > > postgres.pg_constraint... > > template1.pg_statistic... > > template1.pg_attrdef... > > template1.pg_constraint... > > ts.pg_statistic... > > ERROR: canceling statement due to statement timeout > > ts.pg_attrdef... > > ts.pg_constraint... > > postgres.pg_statistic... > > ERROR: missing chunk number 0 for toast value 3372855171 in pg_toast_2619 > > Hm, so was the timeout error happening every time through on that table, > or just occasionally, or did you provoke it somehow? I'm wondering how > your 9s timeout relates to the expected completion time. Actually statement_timeout isn't essential for this (maybe it helps to triggers it more often - not sure). Could you try: time sh -ec 'while :; do time psql postgres -c "VACUUM FULL VERBOSE pg_toast.pg_toast_2619"; psql postgres -c "VACUUM FULL VERBOSE pg_statistic"; done'; date Three servers experienced error within 30min, but one server didn't fail until 12h later, and a handful others still haven't failed.. Does this help at all ? 2018-05-24 21:57:49.98-03 | 5b075f8d.1ad1 | LOG | pryzbyj | postgres | statement: VACUUM FULL VERBOSE pg_toast.pg_toast_2619 2018-05-24 21:57:50.067-03 | 5b075f8d.1ad1 | INFO | pryzbyj | postgres | vacuuming "pg_toast.pg_toast_2619" 2018-05-24 21:57:50.09-03 | 5b075f8d.1ad1 | INFO | pryzbyj | postgres | "pg_toast_2619": found 0 removable, 408 nonremovable row versions in 99 pages 2018-05-24 21:57:50.12-03 | 5b075f8e.1ada | LOG | pryzbyj | postgres | statement: VACUUM FULL VERBOSE pg_statistic 2018-05-24 21:57:50.129-03 | 5b075f8e.1ada | INFO | pryzbyj | postgres | vacuuming "pg_catalog.pg_statistic" 2018-05-24 21:57:50.185-03 | 5b075f8e.1ada | ERROR | pryzbyj | postgres | missing chunk number 0 for toast value 3382957233 in pg_toast_2619 Some thing; this server has autovacuum logging, although it's not clear to me if that's an essential component of the problem, either: 2018-05-24 21:16:39.856-06 | LOG | 5b078017.7b99 | pryzbyj | postgres | statement: VACUUM FULL VERBOSE pg_toast.pg_toast_2619 2018-05-24 21:16:39.876-06 | LOG | 5b078010.7968 | | | automatic vacuum of table "postgres.pg_toast.pg_toast_2619": index scans: 1 + | | | | | pages: 0 removed, 117 r 2018-05-24 21:16:39.909-06 | INFO | 5b078017.7b99 | pryzbyj | postgres | vacuuming "pg_toast.pg_toast_2619" 2018-05-24 21:16:39.962-06 | INFO | 5b078017.7b99 | pryzbyj | postgres | "pg_toast_2619": found 0 removable, 492 nonremovable row versions in 117 pages 2018-05-24 21:16:40.025-06 | LOG | 5b078018.7b9b | pryzbyj | postgres | statement: VACUUM FULL VERBOSE pg_statistic 2018-05-24 21:16:40.064-06 | INFO | 5b078018.7b9b | pryzbyj | postgres | vacuuming "pg_catalog.pg_statistic" 2018-05-24 21:16:40.145-06 | ERROR | 5b078018.7b9b | pryzbyj | postgres | missing chunk number 0 for toast value 765874692 in pg_toast_2619 Or this one? postgres=# SELECT log_time, database, user_name, session_id, left(message,999) FROM postgres_log WHERE (log_time>='2018-05-24 19:56' AND log_time<'2018-05-24 19:58') AND (database='postgres' OR database IS NULL OR user_name IS NULL OR user_name='pryzbyj') AND message NOT LIKE 'statement:%' ORDER BY 1; log_time | 2018-05-24 19:56:35.396-04 database | user_name | session_id | 5b075131.3ec0 left | skipping vacuum of "pg_toast_2619" --- lock not available ... log_time | 2019-05-24 19:57:35.78-04 database | user_name | session_id | 5b07516d.445e left | automatic vacuum of table "postgres.pg_toast.pg_toast_2619": index scans: 1 : pages: 0 removed, 85 remain, 0 skipped due to pins, 0 skipped frozen : tuples: 1 removed, 348 remain, 0 are dead but not yet removable, oldest xmin: 63803106 : buffer usage: 179 hits, 4 misses, 87 dirtied : avg read rate: 1.450 MB/s, avg write rate: 31.531 MB/s : system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.02 s log_time | 2018-05-24 19:57:35.879-04 database | postgres user_name | pryzbyj session_id | 5b07516f.447f left | missing chunk number 0 for toast value 624341680 in pg_toast_2619 log_time | 2018-05-24 19:57:44.332-04 database | user_name | session_id | 5af9fda3.70d5 left | checkpoint starting: time Justin