On Wed, 16 Jul 2003, Timo Sirainen wrote:
> What if the mailbox is all the time opened by other clients, are the
> messages ever really expunged?

Then the space never gets recovered, at least not until there is some sort
of system maintenance garbage-collection.

> That's why I'd rather not have any kind
> of shared locks blocking exclusive locking. When there's a _lot_ of
> clients constantly reading the mailbox and keeping shared locks,
> there's little time to for getting exclusive locks.

Although this is a good sentiment, I don't see the logic of how this
relates to the previous point.

It is a reason to say "I don't want to have garbage-collection depend upon
exclusive access."  If so, then you need a more complex mechanism than is
used in UW imapd's mbx driver.

First, you need to have some sort of share count on the "ghost" messages,
so you know which ghosts are safe to purge.

Second, you need to be able to purge a ghost without impacting other
access.  This means that either you have some sort of mechanism to
communicate the purge of the ghost to other access (which generally
involves locking), or you need to have a data structure in which an
unannounced purge doesn't matter.  That is one of the primary attractions
of the one-message/one-file class formats, as well as a random-access
database in which the purged data is simply placed on the free list.

Since the mbx format is a flat file format with messages stored
contiguously (as opposed to linked-list), neither are options for
lock-free shared access.  The mbx format takes the position that "life is
tough in the big city."  That's not necessarily an invalid position to
take; but it certainly is not valid in all circumstances.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

Reply via email to