[Yum] A couple of problems and RFE for Yum

Michael Stenner mstenner at phy.duke.edu
Tue Oct 21 19:12:30 UTC 2003


On Tue, Oct 21, 2003 at 02:52:16PM -0400, seth vidal wrote:
> On Tue, 2003-10-21 at 14:51, Rick Thomas wrote:
> > It it very important that the update be atomic.
> > 
> > One must write to a scratch file-name in the same filesystem as the file
> > you intend to replace, then set the last-write date, then rename it to
> > the old name.  If you write to the same file your are replacing,  during
> > the actual write the file is incomplete and the date is not the same as
> > the old file.  Anyone who inquires during the write will get the wrong
> > date and an an incomplete file.
> 
> yum writes into a .newheaders dir then does a move of headers to
> .oldheaders the .newheaders to headers.
> 
> it's not quite atomic - but it's as close as you can get on any
> filesystem.

That COULD be atomic, but it may or may not be worth it.  If I
understand correctly, you currently do this:

1) write to .newheaders
2) rename headers to .oldheaders
3) rename .newheaders to headers

If you instead do

1) write to .newheaders
2) COPY headers to .oldheaders
3) rename .newheaders to headers

Then it should be atomic.  That's a significantly heavier operation,
though.

Another alternative is:

1) write to .newheaders
2) HARD LINK headers to .oldheaders
3) rename .newheaders to headers

That's efficient, but requires hard links :)

> > But Seth is very smart, so I assume that he is doing it correctly. 

:)

					-Michael

-- 
  Michael Stenner                       Office Phone: 919-660-2513
  Duke University, Dept. of Physics       mstenner at phy.duke.edu
  Box 90305, Durham N.C. 27708-0305



More information about the Yum mailing list