Simultaneous database access

Wesley Craig wes at umich.edu
Wed Aug 16 15:47:57 EDT 2006


On 16 Aug 2006, at 14:52, David Korpiewski wrote:
> My director had us go back to using our Macs to try to build a  
> failover cluster.   We were able to set up two mail servers sharing  
> the same backend XSAN.   We put our database for cyrus on the XSAN  
> and had both mail servers use _the same_ database and the same mail  
> store locations.
>
> So far in limited testing it works flawlessly.  This is very  
> strange to us.  Is cyrus set up to allow multiple simultaneous  
> accesses to its database without corruption or are we just lucky to  
> not have corrupted the database yet?
>
> This is cyrus 2.2.12 running on two OSX 10.4.7 servers.

The main process which updates mailboxes.db etc on a backend server  
is imapd.  Since multiple imapd's are allowed, as long as your XSAN  
provides appropriate locking, you are not "just lucky".  See the  
compile documentation for a discussion of how to select the locking  
method:

	    --with-lock=METHOD
             Specifies the locking method to use. Currently implemented
             locking methods are:

             flock   flock() locking
             fcntl   fcntl() locking

             By default, configure uses "fcntl" if the "fcntl()"  
function
             exists, "flock" otherwise.


AFAIK, fcntl( ..., F_SETLK*, ...) always locks the whole file, a la  
flock().  Also, I think I see a bug in master/service.c, where  
instead of using the locking method specified during compile-time,  
fcntl() is always used.

:wes


More information about the Info-cyrus mailing list