Greg Stark <gsst...@mit.edu> writes: > On Mon, Feb 22, 2010 at 2:54 AM, Tom Lane <t...@sss.pgh.pa.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers