[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Routers Processing A Single Message (patch enclosed)



> Matti-
> 
> As we have discussed recently, one can enforce single-threadedness of
> renaming of the message files in $POSTOFFICE/router by using link() and
> unlink() and checking the return from unlink().  Participants seemed to be of
> the opinion that unlink() should always be an atomic operation, whereas
> rename() is apparently not always atomic.
> 
> I've implemented this change after testing the theory using file locks for
> several days.  The duplicate messages ceased.

	There were dupes even with file-locks ?

> The diff below changes lib/esyslib.c to never use rename(), but to use link()
> and unlink() instead and check the outcome of the unlink().  If the unlink()
> of "from" fails, then "to" is also unlink()ed and we return -1 to indicate
> failure - either due to an error or because another router process link()ed
> and unlink()ed the file before we could.  This should enforce single-threaded
> renaming in the routers.

	I accepted it in a bit different form.  For  erename()  the rename(2)
	is ok, but for  eqrename()  that is used for acquiring locking, it
	will now always use  link(2)/unlink(2).

	The  rename(2) is nice with NFS, I think.  One message instead of
	a slew of them...

	It looks like ZMailer can never be put on top of Andrew-FS, which
	allows only one link to any file...  (Not that I have any reason
	to want to do that, for that matter.)

> I submit the following diff (against v2.99.46) for your consideration.  I
> have placed the resultant router into production use on several IRIX 5.3
> systems.
> 
> -Andy

	/Matti Aarnio <mea@nic.funet.fi>