dovecot-1.2: virtual optimization: If saved highest-modseq match...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Dec 10 01:58:18 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/f1c4c0c90da1
changeset: 9501:f1c4c0c90da1
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 9cccb8617820 -r f1c4c0c90da1 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
@@ -698,7 +698,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
@@ -715,12 +715,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