On Mon, Jul 25, 2005 at 12:36:43PM -0400, Geo Carncross wrote:

> It is. That's okay- the idea is that "B" will simulate a delete of
> uid "6" as part of the replication, otherwise a client connecting to
> "B" will see two copies of one message, and connecting to "A" it
> will see two copies of a different message.

At least the way I was envisioning it, it's not so much as a "delete"
as an "update" (in SQL terms.)  Ie. in pseudocode, something like
"update email_table set uid=9 where uid=6 and mailbox_id=whatever and
user=whatever".  The key is that "B" shouldn't have to consciously do
it, at the application layer; after "A" updates, the DB layer should
propagate the change to "B"'s DB via replication.

> Think about how you need to replicate changing flags (deleting,
> replied, etc)- those are tied to the UID as far as the client is
> concerned. We need to simulate the delete and copy any flag-changes
> or at the very least, the human being using the mailbox will be
> confused.

Good point.

I don't know dbmail internals, but I'm imagining flags are stored in a
table somewhere, keyed either on UID or on some other attribute of an
email (ie. an internal global unique ID, or the like.)  If they're
keyed on UID, then it is the responsibility of the server that changed
the email UID (ie. server "A") to also maintain referential integrity
of the flag table by changing the UID in the flag table.  If the flags
are stored with a different key, or even better, if they're stored in
the same table as the email, then the changing of the UID has no
impact on the flags, ie. the flags are associated with the email
independently of any changes to UID, and no additional work needs to
be done.

> * Write an IMAP client (steal one)
> * have it select each mailbox in turn, and for each message that has a
> UID on one but not the other:
>       append to both-
>               doing extra appends on one machine until UIDs match
>       delete the originals and extras
>       secret-expunge
> 
> The "replication client" will need to know about "deleted messages" -
> thus DBMail will have to log client-expunges so that they can be
> replicated.
> 
> If flags have changed, copy flags (using logs as well)

Is the replication client itself in charge of replication, or is this
assuming a DB-layer replication and the "replication client" is only
responsible for UID sanitizing?

- Morty

Reply via email to