From Cyrus

Jump to: navigation,

Cyrus 2.4 Changes

[Page Tools]

Summary of changes that are included in the Cyrus 2.4 release

In addition to the LEMONADE extension support that will be going into the Cyrus 2.4 release, following is a summary of the major rewrites that are also going to be included in the Cyrus 2.4 release.

  • mailbox.c largely rewritten
    • APIs to read cyrus.index records into structs, no more direct access
    • APIs to read cyrus.cache records
    • APIs maintain consistency in on disk structures (eg cache of exists/seen/etc counts)
    • APIs maintain CRC checksums for all data structures (cyrus.index records and entire file, cyrus.cache records)
    • Consistent locking to avoid race conditions and ensure correct semantics (eg MODSEQ can't go backwards in different connections)
    • User seen flag moved into cyrus.index, the most common case
    • Date header moved into cyrus.index to make "sort date" fast
    • cyrus.index and cyrus.expunge merged, simplifies code and makes QRESYNC support possible
    • Reconstruct becomes a library function
  • index.c largely rewritten
    • Change model so we maintain cyrus.index record number -> ID mapping in memory rather than using mmap state of cyrus.index on disk
  • mboxname.c
    • New locking structure uses underlying OS to lock at mailbox name level. Removes the need for "reserved" entries in mailboxes.db and avoids races or broken mailboxes.db entries if cyrus killed
  • sync code largely rewritten
    • Protocol changed to make it easier to add things in the future (uses NAME => VALUE pairs in lots of places, rather than positional arguments)
    • Uses MODSEQ to send delta updates, uses fraction of the bandwidth of the old protocol
    • Uses a "sync CRC" to ensure that a delta update leaves both sides in the same state, and if not, does a full check to bring into sync
    • Can recover from split brain scenario automatically using UID promotion logic

And all of this comes with the benefits of:

  • Easier to read code. Lots of copy/paste code has been removed and moved into functions.
  • Less code. About 7000 lines of code have been deleted
  • Consistent locking. Races that existed in the previous code have been dealt with or removed
  • New features. CONDSTORE and QRESYNC are fully supported and correct (even in multiple simultaneous connections and for \Seen flags)
  • Better IMAP conformance. cyrus now passes the IMAP dovecot stress test