[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Distinct transactions



Charlie writes:
> We are proposing:
> (1) copy the config file to some new file.
> (2) modify the new file and close it.
> (3) move the existing config file to a backup file
> (4) move the modified file to replace the original file
> 
> Are we right in assuming that these actions retain their sequentiality with
> journaling?  That is, can we be sure that if (3) occurred in the
> filesystem, that (2) must have been completed?

If you are doing journalling, I would propose the following:
1) copy config to new file
2) modify new file
3) copy original config to backup
4) mv modified file to replace original

The reason for doing this is that at no time will you NOT have a valid
config file in place.  One mv is guaranteed atomic, whereas two are not.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]