[Dovecot] Replication protocol design

Asheesh Laroia asheesh at asheesh.org
Tue Apr 29 02:33:08 EEST 2008

On Tue, 29 Apr 2008, Timo Sirainen wrote:

> I'll probably be implementing multi-master replication this summer. My
> previous thoughts about it are here:
> http://dovecot.org/list/dovecot/2007-December/027284.html
> Below is a description of how the replication protocol will probably
> work. It should work just as well for master-slave and multi-master
> setups. Comments welcome. I'll write later a separate mail about how
> it'll be implemented to Dovecot.

(I'm CC:ing tv since he and I once chatted about IMAP replication.)

Multi-master will be very interesting.  I'm really curious what you will 
do as far as this scenario:

1. A mail arrives in server1
2. User reads it (therefore the mail has a UID assigned)
3. server2 gets isolated from server1
4. A mail arrives at server2
5. User logs in to server2 and reads it (therefore the mail has a UID 
6. server2 and server1 are connected again, and are told to sync


a. Does the client get told two different messages have the same UID in 
the folder?

b. What is the graceful sync proposal?

Oh, look - you mention that right at the end of your protocol:

> A special case is when two servers have been saving messages 
> independently from each others. In this case it's possible that the 
> servers have used the same UIDs for different messages (different global 
> UIDs). These need to be resolved by giving both conflicting UIDs new 
> unused UIDs, otherwise IMAP clients may show them as wrong messages from 
> their caches.
> FIXME: If the other server had expunged a conflicting UID it still 
> should be given a new UID. How do we find out this has happened?

I guess this doesn't address my Question (a), though.

The above scenario may be handled by your root-based election process - 
but what prevents two roots from simultaneously existing, and therefore 
two masters existing, and then the above scenario happening?

I'm really interested to see where this goes - I think this would be 
really swell as a replacement for my use of offlineimap.  I also want to 
have you consider letting non-root users use Dovecot replication features; 
that way, I could just have a cron job that asks my laptop's Dovecot to 
replicate from my server's Dovecot, without giving it any special 

Thanks for all the great work Dovecot represents!

-- Asheesh.

I joined scientology at a garage sale!!

More information about the dovecot mailing list