dovecot-2.0: virtual optimization: If saved highest-modseq match...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Dec 10 01:58:30 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/b7ce62749fd7
changeset: 10443:b7ce62749fd7
user: Timo Sirainen <tss at iki.fi>
date: Wed Dec 09 18:58:13 2009 -0500
description:
virtual optimization: If saved highest-modseq matches current one, don't try to find higher ones.
diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
src/plugins/virtual/virtual-sync.c | 16 ++++++++++------
diffs (34 lines):
diff -r aa97e059ca32 -r b7ce62749fd7 src/plugins/virtual/virtual-sync.c
--- a/src/plugins/virtual/virtual-sync.c Wed Dec 09 18:47:27 2009 -0500
+++ b/src/plugins/virtual/virtual-sync.c Wed Dec 09 18:58:13 2009 -0500
@@ -689,7 +689,7 @@ static int virtual_sync_backend_box_cont
struct index_mailbox *ibox = (struct index_mailbox *)bbox->box;
struct mail_search_result *result;
ARRAY_TYPE(seq_range) removed_uids, added_uids, flag_update_uids;
- uint64_t modseq;
+ uint64_t modseq, old_highest_modseq;
uint32_t seq, uid, old_msg_count;
/* initialize the search result from all the existing messages in
@@ -706,12 +706,16 @@ static int virtual_sync_backend_box_cont
!mail_index_lookup_seq_range(ibox->view, 1, bbox->sync_next_uid-1,
&seq, &old_msg_count))
old_msg_count = 0;
+ old_highest_modseq = mail_index_modseq_get_highest(ibox->view);
+
t_array_init(&flag_update_uids, I_MIN(128, old_msg_count));
- for (seq = 1; seq <= old_msg_count; seq++) {
- modseq = mail_index_modseq_lookup(ibox->view, seq);
- if (modseq > bbox->sync_highest_modseq) {
- mail_index_lookup_uid(ibox->view, seq, &uid);
- seq_range_array_add(&flag_update_uids, 0, uid);
+ if (bbox->sync_highest_modseq < old_highest_modseq) {
+ for (seq = 1; seq <= old_msg_count; seq++) {
+ modseq = mail_index_modseq_lookup(ibox->view, seq);
+ if (modseq > bbox->sync_highest_modseq) {
+ mail_index_lookup_uid(ibox->view, seq, &uid);
+ seq_range_array_add(&flag_update_uids, 0, uid);
+ }
}
}
More information about the dovecot-cvs
mailing list