dovecot-2.2: lib-storage: Avoid rebuilding the whole mailbox lis...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Apr 15 13:32:27 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/6fd12fbe6848
changeset: 17209:6fd12fbe6848
user: Timo Sirainen <tss at iki.fi>
date: Tue Apr 15 15:13:28 2014 +0200
description:
lib-storage: Avoid rebuilding the whole mailbox list index when one mailbox changes.
diffstat:
src/lib-storage/list/mailbox-list-index-status.c | 21 +++++++++++++++------
src/lib-storage/list/mailbox-list-index.h | 1 +
2 files changed, 16 insertions(+), 6 deletions(-)
diffs (65 lines):
diff -r 978871ca81e7 -r 6fd12fbe6848 src/lib-storage/list/mailbox-list-index-status.c
--- a/src/lib-storage/list/mailbox-list-index-status.c Wed Apr 09 23:19:29 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-index-status.c Tue Apr 15 15:13:28 2014 +0200
@@ -53,7 +53,10 @@
if (ret != 0) {
/* error / mailbox has changed. we'll need to sync it. */
- mailbox_list_index_refresh_later(box->list);
+ if (ret < 0)
+ mailbox_list_index_refresh_later(box->list);
+ else
+ ilist->index_last_check_changed = TRUE;
mail_index_view_close(&view);
return ret < 0 ? -1 : 0;
}
@@ -366,10 +369,14 @@
list_view = mail_index_view_open(ilist->index);
if (!index_list_update_fill_changes(box, list_view, &changes))
ret = -1;
- else if (!index_list_has_changed(box, list_view, &changes))
- ret = 0;
- else
+ else if (index_list_has_changed(box, list_view, &changes))
ret = 1;
+ else {
+ /* if backend state changed on the last check, update it here
+ now. we probably don't need to bother checking again if the
+ state had changed? */
+ ret = ilist->index_last_check_changed;
+ }
mail_index_view_close(&list_view);
if (ret <= 0) {
if (ret < 0)
@@ -394,9 +401,10 @@
if (!index_list_update_fill_changes(box, list_view, &changes))
mailbox_list_index_refresh_later(box->list);
- else if (index_list_has_changed(box, list_view, &changes)) {
+ else {
ilist->updating_status = TRUE;
- index_list_update(box, list_view, list_trans, &changes);
+ if (index_list_has_changed(box, list_view, &changes))
+ index_list_update(box, list_view, list_trans, &changes);
if (box->v.list_index_update_sync != NULL) {
box->v.list_index_update_sync(box, list_trans,
changes.seq);
@@ -408,6 +416,7 @@
mailbox_set_index_error(box);
return -1;
}
+ ilist->index_last_check_changed = FALSE;
return 0;
}
diff -r 978871ca81e7 -r 6fd12fbe6848 src/lib-storage/list/mailbox-list-index.h
--- a/src/lib-storage/list/mailbox-list-index.h Wed Apr 09 23:19:29 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-index.h Tue Apr 15 15:13:28 2014 +0200
@@ -107,6 +107,7 @@
unsigned int syncing:1;
unsigned int updating_status:1;
unsigned int has_backing_store:1;
+ unsigned int index_last_check_changed:1;
};
struct mailbox_list_index_iterate_context {
More information about the dovecot-cvs
mailing list