Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5B4856326F2 for ; Sun, 14 Feb 2010 16:57:24 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00578-03 for ; Sun, 14 Feb 2010 20:57:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f219.google.com (mail-fx0-f219.google.com [209.85.220.219]) by mail.postgresql.org (Postfix) with ESMTP id C5EEE632657 for ; Sun, 14 Feb 2010 16:57:10 -0400 (AST) Received: by fxm19 with SMTP id 19so17027fxm.23 for ; Sun, 14 Feb 2010 12:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=68mc13iHnW3Cj8om5t009b3/vJwqog1Qg03n0BqLl1c=; b=u/5H1M/59lwbBe5jXFVB2EwaoKUpvPL9cJlztS38GghKy4jm+wVPU7ZCPmicxEen9K ypN64oNtzWG7bBu8azmFyU079iOzdNglA0q6FY1Q/wK1YqrkRdQ0Uwyq4YXskO9zyCaS zSSgQUKrtwp52CJvkvY/3E46SUtTb/UBoWjKA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=u2ZfJVz1jf8/yTSPoEjHUVEaa2w+3S8s011zsf2bGi0YlZqQqL5OxGl8YVcpOQWLL0 Tvilnm7S+AFV2rCrVKUlqHk8GyWr8wf7eM0RBUOriWpIyxhVBBrgAbgEI0hKd+k9Bb4Y mCJfFTaPvDcK1eJUkkqpYVe6RzEnyzeYM3rds= MIME-Version: 1.0 Received: by 10.239.193.144 with SMTP id j16mr456068hbi.45.1266181029025; Sun, 14 Feb 2010 12:57:09 -0800 (PST) In-Reply-To: <407d949e1002140731j85a4f97nc053ec1b0f3cc458@mail.gmail.com> References: <4427a97a0912101235x3ade510blcc00d5ce9883c6b6@mail.gmail.com> <20100208030901.GA7407@alvh.no-ip.org> <603c8f071002072053w16897addtd52fcc4cf880df53@mail.gmail.com> <201002110327.35810.andres@anarazel.de> <603c8f071002120749o6a2e9e54h5cf21dc91d1790b9@mail.gmail.com> <407d949e1002140603v1c7515d7t697568a3865ac6fe@mail.gmail.com> <407d949e1002140731j85a4f97nc053ec1b0f3cc458@mail.gmail.com> Date: Sun, 14 Feb 2010 15:57:08 -0500 Message-ID: <603c8f071002141257g2dfb7a09i5c5930e9787783e1@mail.gmail.com> Subject: Re: Re: Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb) From: Robert Haas To: Greg Stark Cc: Andres Freund , pgsql-hackers@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.478 tagged_above=-10 required=5 tests=AWL=0.121, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/1163 X-Sequence-Number: 157506 On Sun, Feb 14, 2010 at 10:31 AM, Greg Stark wrote: > On Sun, Feb 14, 2010 at 2:03 PM, Greg Stark wrote: >> On Fri, Feb 12, 2010 at 3:49 PM, Robert Haas wro= te: >>> Greg Stark, have you managed to get your access issues sorted out? =A0I= f >> >> Yep, will look at this today. > > So I think we have a bigger problem than just copydir.c. It seems to > me we should be fsyncing the table space data directories on every > checkpoint. Otherwise any newly created relations or removed relations > could disappear even though the data in them was fsynced. I'm thinking > I should add an _mdfd_opentblspc(reln) call which returns a file > descriptor for the tablespace and have mdsync() use that to sync the > directory whenever it fsyncs a relation. It would be nice to remember > which tablespaces have been fsynced and only fsync them once though, > that would need another hash table just for tablespaces. > > We probably also need to fsync the pg_xlog directory every time we > create or rename an xlog segment. > > Are there any other places we do directory operations which we need to > be permanent? I agree with Tom that we need to see some actual reproducible test cases where this is an issue before we go too crazy with it. In theory what you're talking about could also happen when extending a relation, if we extend into a new file; but I think we need to convince ourselves that it really happens before we make any more changes. On a pragmatic note, if this does turn out to be a problem, it's a bug: and we can and do fix bugs whenever we discover them. But the other part of this patch - to speed up createdb - is a feature - and we are very rapidly running out of time for 9.0 features. So I'd like to vote for getting the feature part of this committed (assuming it's in good shape, of course) and we can continue to investigate the other issues but without quite as much urgency. ...Robert