Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Date
Msg-id 3943.1266807280@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Andres Freund <andres@anarazel.de>)
Responses Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Greg Stark <gsstark@mit.edu>)
List pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> I just found a relatively big problem with one of your modifications on the
> patch - you removed the
> FreeDir(xldir);
> xldir = AllocateDir(fromdir);
> pair - unfortunately its crucial because otherwise the DIR does not get
> rewound - that resulted in *no* files getting fsync()ed (otherwise the loop
> above wouldn't have finished yet...).
> I think that was also causing the problems I pointed out in " Directory fsync
> and other fun"...

Actually, that code had *multiple* problems including stat'ing the wrong
file entirely, not to mention that this last commit failed to even
compile.  I also think it should scan the todir not the fromdir, just on
general principles to avoid any possibility of race conditions.

            regards, tom lane

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix multiple copy and paste-o's.
Next
From: Greg Stark
Date:
Subject: Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after