cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
528 stars 145 forks source link

mupdate slave thread should commit less frequently #497

Open brong opened 21 years ago

brong commented 21 years ago

From: Rob Siemborski Bugzilla-Id: 1799 Version: 2.2.x Owner: Ken Murchison

brong commented 21 years ago

From: Rob Siemborski

The thread on mupdate slaves that keeps the local db in sync makes a lot of commits, really it should only need to commit after every few events, provided the events are streamed (and we're not blocking waiting for more).

most of the groundwork for this (making the mboxlist api support transactions) has been laid, however its unclear how this should actually all be integrated into mupdate.

currently, cmd_change is called for each update that occurs, this takes the change, updates the database, and posts an event to each of the waiting threads for our clients (And signals them). However, strange results are likely if we don't commit the transaction before signaling the other threads.

ksmurchison commented 7 years ago

It appears that if this is causing a performance issue that cmd_change() could be altered to create a linked list of struct mbent and then return that list to mupdate_scarf() as context, where all of the database_log()s could be batched in one txn and the log_update()s done upon successful commit of the txn.

Changed the disposition of this issue from "bug" to "enhancement"