Re: How MHonArc assigns message numbers

1998-02-25 09:13:59
sub getNewMsgNum {
    $NumOfMsgs++; $LastMsgNum++;

Is this atomic?  Can two processes end up with the same number?

The routine is not atomic (in an execution view point), but is only
called when mhonarc gets a lock on an archive.  So it is protected
using a "semaphore-like" operation.

Things can get screwed up if one mhonarc process has a lock on archive,
and another process is invoked with the -force option and the first
process is not done before the force process starts its work.  Note,
the force process will still try to obtain a lock like a regular
process, but if the lock fails it will still continue execution.

A way to check if two messages have been assigned the same number is to
check the %IndexNum hash in .mhonarc.db to see if there are two values
that are the same.  If this is the case, then something screwy has
happened, like the above scenario.

If the same number gets assigned to more than one message, then report
it as a bug if it can be reproduced and it does not fall under the
umbrella of using -force.


<Prev in Thread] Current Thread [Next in Thread>