Date: Sun, 10 Dec 2006 20:02:40 +0000 (GMT) From: Jan Grant <jan.grant@bristol.ac.uk> To: White Hat <pigskin_referee@yahoo.com> Cc: FreeBSD Users Questions <freebsd-questions@freebsd.org> Subject: Re: Atomic Update Message-ID: <20061210200053.R61342@tribble.ilrt.bris.ac.uk> In-Reply-To: <20061210133927.6212.qmail@web34404.mail.mud.yahoo.com> References: <20061210133927.6212.qmail@web34404.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 10 Dec 2006, White Hat wrote: > I am not sure what the correct procedure is to do an > atomic update. > > Scenario: > > 1) Download database-1. This database is going to > replace an identically named database. Since I cannot > shut down the program that is using this database, > what would be the best way to insert the new database. > I was thinking that I could use the 'mv' command as > opposed to 'cp', but I am not sure. You don't mention what software is consuming your database file. It's true that "mv" within a filesystem is an atomic operation, it is not necessarily the case that an arbitrary program that is using the target file will notice the change; for instance, if the target program just has an open filehandle to the file, then it would need to reopen the file once the replacement had taken place. -- jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/ Tel +44 (0)117 3317661 http://ioctl.org/jan/ The Java disclaimer: values of 'anywhere' may vary between regions.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061210200053.R61342>