[ale] [OT] webserver and atomic actions

Danny Cox danscox at mindspring.com
Thu Nov 13 20:57:32 EST 2003


Cade,

On Wed, 2003-11-12 at 09:50, Cade Thacker wrote:
> I am worried that when the file is updated, that a client could pull a
> partially file(or empty file).
> 
> Any thoughts on how to make sure that a client always gets a full file?
> Should I use two file with symbolic links? Link points to file1, update
> file two, switch link, five minutes later, update file1 switch link back
> to file1? Is the linking action atomic enough?

	A long time ago, in a galaxy far away....no, wait.

	We used a queueing system called MDQS: Multi-Device-Queueing-System,
from BRL (the Ballistic Research Lab).  It had a config file that had a
feature to counter exactly that: it was many lines long, but only a
couple of K.  What it did was place a specific string, "EOF" as the very
last line, and the routine that read it checked for it.  If it wasn't
found, it tried again.

	In your case, could you make the software verify that it actually got a
newline?  Failing that, then Mike's suggestion of writing it to one
file, and then linking to it via another path is good.  Linking is an
atomic operation under UNIX/Linux.

	HTH!

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny



More information about the Ale mailing list