On Tue, Jul 26, 2005 at 10:30:21AM -0400, Geo Carncross wrote: > If a flag changes on UID 9 on host A and host B at nearly the same > time (between replications) which flag change wins? What if they're > not incompatible (one marking +FOOBaz and the other marking > \Answered ?)
In order for that to happen, the user has to have connected to each of A and B and set flags on UID 9 during each session. In which case, I don't see how you can know what the user wants. Just because you can merge +FooBaz and \Answered doesn't mean the user wanted that. Say +FooBaz is the user's way of saying "I want to answer this message later." So he first sets +FooBaz. Later on, he goes into his mailbox and doesn't see any messages with +FooBaz, so he curses the sysadmins and goes looking for the message he wanted to answer, and answers it. So his MUA sets \Answered, and he deliberately doesn't set +FooBaz because he's already answered. Then replication happens, and the server carefully merges flags -- and now +FooBaz is set again! The user will really be pissed, now. Or maybe +FooBaz means "I want to show this email to my boss", in which case the user might have wanted +FooBaz, and maybe figured it was already set. In which case you should merge. So I'm in favor of last-update-wins, and let the underlying DB pick. Since you're guessing anyway, why not guess the easy way? That's said, does dbmail store multiple flags as a single string, or is each flag a separate entry in a relational table? Because if the latter, setting and removing flags becomes INSERTs and DELETEs, which are easily replicable and will merge automatically. Which, again, I think is guessing, and again, since you're guessing, why not guess the easy way? > In reality, the IMAP server can avoid the overhead of sending the > message back and forth by simply modifying the various db attributes, > but to find out exactly how your scheme would fare against other > clients, I'd suggest this less invasive approach. > > Since the algorithm isn't strictly RFC2060 conforming (and clients > aren't strictly RFC2060 conforming) it's important to find out exactly > how clients will deal with UIDs moving around on them all the time. Since I'm still reading the RFC, I'll defer to you on that. . . - Morty