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

Re: rotating logfiles

 > > [If the scheduler is restarted and mail delivery is under way,
 > >  double delivery may occur]
 > Blech.
 > Just when you think mutual exclusion is a solved problem, some
 > Unix tool goes and unsolves it.

Unix doesn't really support any reliable transactions, so there's no
easy and *simple* way to make it work perfectly. Usually anything over
a single block -sized write to a single file is not guaranteed to go
"right" in this sense and NFS et al make things worse.

When you cannot atomically update mailboxes (and do many other things)
anyway, it would be pretty hard to implement better methods. 
Would you want some horrible code to try to "unwrite" (abort the
transaction) the half-written message from the mailbox(es) if the host
crashes, or if the scheduler is restarted, or ...

What if the mailbox delivery agent is writing a big e-mail message
while the scheduler is restarting? Or it may be piping the message to
some slow script that takes ages to complete. If you set some
delivery-in-progress flag and the scheduler believes it, who will
deliver after a crash when the flag is set but delivery didn't finish?

I think it is much better to not worry about this, and try to keep the
program simple and just code defensively -- double delivery
occasionally is not a big problem.

An e-mail delivery system / news server / ... should be implemented on
top of a reliable, fast and cheap/free database, but there is no such
thing generally available on every platform...

	NFS -- No File System