Subject: Git for redundant mail servers

From: David Woodhouse <[email-masked]>
Date: Sat, 23 Apr 2005 16:42:41 +1000

Random alternative use for git... we could use it to provide a cluster
of redundant mail delivery/storage servers. 

The principle is simple; you use something like a set of Maildir
folders, stored in a git repository. Any action on the mail storage is
done as a commit -- that includes delivery of new mail, or user actions
from the IMAP server such as changing flags, deleting or moving mail.
These actions are actually fairly efficient when Maildir folders are
stored in a git repository -- the IMAP model is that mails are
immutable, and flag changes are done as renames.

In the normal case where all the servers are online, each commit is
immediately pushed to each remote server. When a server is offline or
separated somehow from the rest of the group, it's going to have to do a
merge when it reconnects -- we'd implement a Maildir-specific merge
algorithm, which really isn't that hard to do.

In this case we'd probably want to make active use of the feature of git
which allows you to prune history. You don't need to keep any history
further back than the commit which will be the common ancestor when a
currently-absent member of the cluster eventually comes back. In the
common case, that will actually be no history at all, since all members
will be present.

You can then have multiple members of a cluster, each running an SMTP
server and allowing for delivery of email, and each running an IMAP
server. Clients can connect to any of the machines and receive IMAP
service, and email will continue to flow inward, as long as at least one
machine in the cluster remains alive. 

-- 
dwmw2