Greg Stark <gsstark(at)mit(dot)edu> writes:
> On Mon, Feb 22, 2010 at 2:54 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I also think it should scan the todir not the fromdir, just on
>> general principles to avoid any possibility of race conditions.
> I had concluded that scanning the original directory was odd but
> better because it served to double-check that all the original files
> actually made it and also because if there were any unrelated files
> present there was no need to fsync them.
Well, just for the record: if that was actually intentional then both of
you erred seriously by not including a comment that explained that the
coding was intentional (and giving the reasoning). Any reader of the
code would have assumed that it was a copy-and-paste error, as I did.
> But I agree it's odd and not
> very general for copydir if we decide to use it elsewhere other than
> create database.
Yeah, to me it seems more likely to cause problems down the road than
to catch anything. If the system is missing directory entries during
ReadDir then we have problems far beyond what copydir can deal with.
The point of the fsync loop is just to force the copy results down to
the platter, not to cross-check that the source directory isn't
changing. (And, what's more, I don't believe that the source directory
can't change during CREATE DATABASE. Consider delayed cleanup of
deleted relations during checkpoints.)
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Pavel Stehule||Date: 2010-02-22 15:31:45|
|Subject: Re: Plans for 9.1, Grouping Sets, disabling multiqueries, contrib module for string, plpgpsm, preload dictionaries|
|Previous:||From: Robert Haas||Date: 2010-02-22 14:46:36|
|Subject: ALTER TABLE documentation|
pgsql-committers by date
|Next:||From: Tom Lane||Date: 2010-02-22 15:26:15|
|Subject: pgsql: Adjust pg_fsync_writethrough so that it will set errno when |
|Previous:||From: Heikki Linnakangas||Date: 2010-02-22 11:47:30|
|Subject: pgsql: Move documentation of all recovery.conf option to a new chapter.|