Atomic Update
Jan Grant
jan.grant at bristol.ac.uk
Sun Dec 10 12:03:23 PST 2006
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.
More information about the freebsd-questions
mailing list