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 1iXEha-0002Fl-Sx for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 01:22:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXEhZ-00087A-F0 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 01:22:37 +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 1iXEhY-000872-VS for pgsql-hackers@lists.postgresql.org; Wed, 20 Nov 2019 01:22:37 +0000 Received: from mail-yw1-xc41.google.com ([2607:f8b0:4864:20::c41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iXEhR-0002b9-Nu for pgsql-hackers@postgresql.org; Wed, 20 Nov 2019 01:22:35 +0000 Received: by mail-yw1-xc41.google.com with SMTP id v84so8092053ywc.4 for ; Tue, 19 Nov 2019 17:22:29 -0800 (PST) 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=DpdA3zEUIunx4lr6Ne3/Iy2y59v1QvAp97tt98mCPlU=; b=vKr8IcX3y8HXIXio5HiNHbP167srKAAfhdXQsYc0QS+Ej2Q7mNAFG+gFKtkhf48Xkz 38hPkB4WTZZh57CYC3vrkCkxK56K/r0kSylAiVgekf1pqgKFTJ76kBauOdI3l8YyKOfh Pdek6B0IGyTY/4WTjOVPKCk+bJCKCsSYrn10WdAve1TqN/ADAvJbT29K62CWzHIU9NGP AGXNy2CuYM5kZ6BiSkfGLtAQE1PwXOc70Gvs0a02ukNUYIUF41Jn8NYLD5nejdkOtbWp 0FICggrj6DuexUGA0Adq4boNKkRtO5RSclc4AZy3JNlfDNiOp2+SijcbLkVf09KivU4t ZNQw== 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=DpdA3zEUIunx4lr6Ne3/Iy2y59v1QvAp97tt98mCPlU=; b=mdhvSg5WZ8bUxPrHVm3X6L/WxzBQ0UUdeMAouLNfTFR6xD5paMIQtlL1AUEmWbAQkF 62/aNFabS7ltMM1vqguoFbjA8Y2QOTzldd2KNtdKWo/C5aMi5SUF7wggMXwz3cbzHzDx 9uZS+5HLJw/RfHqyD9aqedGgxsEFrpvZiabt0GH/Y6zdNAKDuftc2r5x25QVvhT140pX B7CHwJWcAP07gBRka2eoWAboJQRmCUtMGaIUrNRlcXTPZPPmNmLIFxclYyMC+NtwMMSM HsQ8RVseBdKJ4TrqSasr+Y4YSPOQwKT7u8tlcCvQ6OC0bDD/+T6zDSOnJPhEKCjHWHzw nNXQ== X-Gm-Message-State: APjAAAX7o7oAhID/yMbzaT7kJ7SzlT/3PhXhOvxtYA9zlDyx5HrTvQZ/ eYkeXJga+MBu/7fjTAcWqevQrO2JN/0= X-Google-Smtp-Source: APXvYqx9Ua5UX8rVzG3GxG7LX/PZ9LLNE1BiNmK0FEV5ObF3HtxecNjUQ/5/rtHmJdz09iDQQjLn6A== X-Received: by 2002:a81:8301:: with SMTP id t1mr59487ywf.400.1574212948861; Tue, 19 Nov 2019 17:22:28 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w74sm10264390ywd.17.2019.11.19.17.22.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 17:22:28 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id C2534800897; Tue, 19 Nov 2019 19:22:26 -0600 (CST) Date: Tue, 19 Nov 2019 19:22:26 -0600 From: Justin Pryzby To: Thomas Munro Cc: pgsql-hackers@postgresql.org Subject: Re: checkpointer: PANIC: could not fsync file: No such file or directory Message-ID: <20191120012226.GW30362@telsasoft.com> References: <20191119115759.GI30362@telsasoft.com> <20191119224910.GU30362@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191119224910.GU30362@telsasoft.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Nov 19, 2019 at 04:49:10PM -0600, Justin Pryzby wrote: > On Wed, Nov 20, 2019 at 09:26:53AM +1300, Thomas Munro wrote: > > Perhaps we should not panic if we failed to open (not fsync) the file, > > but it's not the root problem here which is that somehow we thought we > > should be fsyncing a file that had apparently been removed already > > (due to CLUSTER, VACUUM FULL, DROP, rewriting ALTER etc). Note, the ALTER was (I think) building index in a parallel process: 2019-11-15 22:16:08.752-05 | 5976 | terminating connection because of crash of another server process 2019-11-15 22:16:08.751-05 | 27384 | checkpointer process (PID 27388) was terminated by signal 6: Aborted 2019-11-15 22:16:08.751-05 | 27384 | terminating any other active server processes 2019-11-15 22:16:07.098-05 | 27388 | could not fsync file "base/16491/1731839470.2": No such file or directory 2019-11-15 22:15:59.592-05 | 19860 | duration: 220283.831 ms statement: ALTER TABLE child.eric_enodeb_cell_201811 ALTER pmradiothpvolulscell TYPE integer USING pmradiothpvolulscell::integer 2019-11-15 22:15:59.459-05 | 19860 | temporary file: path "base/pgsql_tmp/pgsql_tmp19860.82.sharedfileset/1.0", size 5144576 2019-11-15 22:15:59.458-05 | 19860 | temporary file: path "base/pgsql_tmp/pgsql_tmp19860.82.sharedfileset/2.0", size 6463488 2019-11-15 22:15:59.456-05 | 19860 | temporary file: path "base/pgsql_tmp/pgsql_tmp19860.82.sharedfileset/0.0", size 4612096 FYI, that table is *currently* (5 days later): ts=# \dti+ child.eric_enodeb_cell_201811* child | eric_enodeb_cell_201811 | table | telsasoft | | 2595 MB | child | eric_enodeb_cell_201811_idx | index | telsasoft | eric_enodeb_cell_201811 | 120 kB | child | eric_enodeb_cell_201811_site_idx | index | telsasoft | eric_enodeb_cell_201811 | 16 MB | I don't know if that table is likely to be the one with relfilenode 1731839470 (but it certainly wasn't its index), or if that was maybe a table (or index) from an earlier ALTER. I tentatively think we wouldn't have had any other tables being dropped, partitions pruned or maintenance commands running. Checkpoint logs for good measure: 2019-11-15 22:18:26.168-05 | 10388 | checkpoint complete: wrote 2915 buffers (3.0%); 0 WAL file(s) added, 0 removed, 18 recycled; write=30.022 s, sync=0.472 s, total=32.140 s; sync files=107, longest=0.364 s, average=0.004 s; distance=297471 kB, estimate=297471 kB 2019-11-15 22:17:54.028-05 | 10388 | checkpoint starting: time 2019-11-15 22:16:53.753-05 | 10104 | checkpoint complete: wrote 98275 buffers (100.0%); 0 WAL file(s) added, 0 removed, 43 recycled; write=11.040 s, sync=0.675 s, total=11.833 s; sync files=84, longest=0.335 s, average=0.008 s ; distance=698932 kB, estimate=698932 kB 2019-11-15 22:16:41.921-05 | 10104 | checkpoint starting: end-of-recovery immediate 2019-11-15 22:16:08.751-05 | 27384 | checkpointer process (PID 27388) was terminated by signal 6: Aborted 2019-11-15 22:15:33.03-05 | 27388 | checkpoint starting: time 2019-11-15 22:15:03.62-05 | 27388 | checkpoint complete: wrote 5436 buffers (5.5%); 0 WAL file(s) added, 0 removed, 45 recycled; write=28.938 s, sync=0.355 s, total=29.711 s; sync files=22, longest=0.174 s, average=0.016 s; d istance=740237 kB, estimate=740237 kB 2019-11-15 22:14:33.908-05 | 27388 | checkpoint starting: time I was trying to reproduce what was happening: set -x; psql postgres -txc "DROP TABLE IF EXISTS t" -c "CREATE TABLE t(i int unique); INSERT INTO t SELECT generate_series(1,999999)"; echo "begin;SELECT pg_export_snapshot(); SELECT pg_sleep(9)" |psql postgres -At >/tmp/snapshot& sleep 3; snap=`sed "1{/BEGIN/d}; q" /tmp/snapshot`; PGOPTIONS='-cclient_min_messages=debug' psql postgres -txc "ALTER TABLE t ALTER i TYPE bigint" -c CHECKPOINT; pg_dump -d postgres -t t --snap="$snap" |head -44; Under v12, with or without the CHECKPOINT command, it fails: |pg_dump: error: query failed: ERROR: cache lookup failed for index 0 But under v9.5.2 (which I found quickly), without CHECKPOINT, it instead fails like: |pg_dump: [archiver (db)] query failed: ERROR: cache lookup failed for index 16391 With the CHECKPOINT command, 9.5.2 works, but I don't see why it should be needed, or why it would behave differently (or if it's related to this crash).