Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4ADA137BCA1 for ; Wed, 8 Oct 2008 11:38:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 51237-05 for ; Wed, 8 Oct 2008 11:38:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 3051437BA28 for ; Wed, 8 Oct 2008 11:38:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m98Ec1SK029541; Wed, 8 Oct 2008 10:38:01 -0400 (EDT) To: Matthew Wakeling cc: pgsql-performance@postgresql.org Subject: Re: Disc space usage In-reply-to: References: <27956.1223471810@sss.pgh.pa.us> Comments: In-reply-to Matthew Wakeling message dated "Wed, 08 Oct 2008 15:00:24 +0100" Date: Wed, 08 Oct 2008 10:38:01 -0400 Message-ID: <29539.1223476681@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/37 X-Sequence-Number: 31618 Matthew Wakeling writes: > Speaking to some of my colleagues, sometimes the createdb process fails > with a very specific error message. If we wait five seconds and try again, > then it succeeds. So, maybe the duff directories are from those failures. > The error message is always something like this: > createdb: database creation failed: ERROR: could not stat file "base/32285287/32687035": No such file or directory > Just before running createdb, we always have some quite heavy write > traffic. Hmm, would that include dropping tables in the database you are about to copy? If so, this error is fairly readily explainable as a side effect of the delayed dropping of physical files in recent PG versions. (As noted in the manual, CREATE DATABASE isn't really intended as a COPY DATABASE operation --- it is expecting the source database to be pretty static. I think you could make this more reliable if you do a manual checkpoint between modifying the source database and copying it.) However, that still leaves me wondering why the leftover copied directories stick around. If the copying step failed that way, CREATE DATABASE *should* try to clean up the target tree before exiting. And AFAICS it wouldn't even report the error until after completing that cleanup. So there's still some piece of the puzzle that's missing. Do you have some specific examples of this error message at hand? Can you try to confirm whether the reported path corresponds to something in the CREATE's source database? If it's actually complaining about a stat failure in the target tree, then there's something else going on altogether. I don't see anything in that path that would give this message, but I might be missing it. regards, tom lane