Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebaUv-0008Am-M1 for pgsql-general@arkaria.postgresql.org; Tue, 16 Jan 2018 23:18:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebaUu-0004ox-Uq for pgsql-general@arkaria.postgresql.org; Tue, 16 Jan 2018 23:18:28 +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.84_2) (envelope-from ) id 1ebaUu-0004on-NG for pgsql-general@lists.postgresql.org; Tue, 16 Jan 2018 23:18:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ebaUs-00050o-0Y for pgsql-general@postgresql.org; Tue, 16 Jan 2018 23:18:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0GNINqB001665; Tue, 16 Jan 2018 18:18:23 -0500 From: Tom Lane To: Daniel Farina cc: pgsql-general@postgresql.org Subject: Re: Extra files in "base" dir not seen in relfilenodes In-reply-to: References: <794.1516143838@sss.pgh.pa.us> Comments: In-reply-to Daniel Farina message dated "Tue, 16 Jan 2018 23:08:35 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1663.1516144703.1@sss.pgh.pa.us> Date: Tue, 16 Jan 2018 18:18:23 -0500 Message-ID: <1664.1516144703@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Daniel Farina writes: > On Tue, Jan 16, 2018 at 3:04 PM Tom Lane wrote: >> Umm ... are you accounting for catalogs that have zeroes in >> pg_class.relfilenode? It's generally better to rely on the >> pg_relation_filenode(oid) function than the raw column contents. > Yeah, the catalogs are not considered here (oids < 10000). The oids in > question are rather high. Let me re-run the antijoin with the function > though.... > Indeed, same result. Hmm, you should have gotten a result that was different by the size of the bootstrap catalogs (pg_class, pg_attribute, pg_proc, pg_type, plus their indexes). I'm worried that you're going to accidentally delete those critical catalogs. However, assuming you've gotten that detail right, then any file you can't match up with a relfilenode value must be an orphan you can just "rm". Do you have any theories about how the DB got like this? Were there system crashes or anything like that recently? Is there any pattern to the file access or mod dates on the putatively-orphaned files? regards, tom lane