dovecot-2.2: lib-index: Don't lookup mail's expunge-state in tra...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 16 13:38:25 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/f9b1aaf844c8
changeset: 15775:f9b1aaf844c8
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 16 13:38:10 2013 +0200
description:
lib-index: Don't lookup mail's expunge-state in transaction log view if caller doesn't care.
This was especially bad with dsync, which could trigger sorting of the
expunges array each time after processing a mail (= potentially tens of
thousands of sorts).
diffstat:
src/lib-index/mail-index-transaction-view.c | 9 ++++++---
src/lib-index/mail-index-view.c | 22 ++++++++++++----------
2 files changed, 18 insertions(+), 13 deletions(-)
diffs (103 lines):
diff -r 9847164c6fd7 -r f9b1aaf844c8 src/lib-index/mail-index-transaction-view.c
--- a/src/lib-index/mail-index-transaction-view.c Sat Feb 16 13:34:13 2013 +0200
+++ b/src/lib-index/mail-index-transaction-view.c Sat Feb 16 13:38:10 2013 +0200
@@ -139,14 +139,16 @@
/* FIXME: is this right to return index map..?
it's not there yet. */
*map_r = view->index->map;
- *expunged_r = FALSE;
+ if (expunged_r != NULL)
+ *expunged_r = FALSE;
return mail_index_transaction_lookup(tview->t, seq);
}
rec = tview->super->lookup_full(view, seq, map_r, expunged_r);
rec = tview_apply_flag_updates(tview, *map_r, rec, seq);
- if (mail_index_transaction_is_expunged(tview->t, seq))
+ if (expunged_r != NULL &&
+ mail_index_transaction_is_expunged(tview->t, seq))
*expunged_r = TRUE;
return rec;
}
@@ -413,7 +415,8 @@
i_assert(ext_id < array_count(&view->index->extensions));
- *expunged_r = FALSE;
+ if (expunged_r != NULL)
+ *expunged_r = FALSE;
if (array_is_created(&tview->t->ext_rec_updates) &&
ext_id < array_count(&tview->t->ext_rec_updates)) {
diff -r 9847164c6fd7 -r f9b1aaf844c8 src/lib-index/mail-index-view.c
--- a/src/lib-index/mail-index-view.c Sat Feb 16 13:34:13 2013 +0200
+++ b/src/lib-index/mail-index-view.c Sat Feb 16 13:38:10 2013 +0200
@@ -181,13 +181,15 @@
/* we'll need to return something so the caller doesn't crash */
*map_r = view->map;
- *expunged_r = TRUE;
+ if (expunged_r != NULL)
+ *expunged_r = TRUE;
return &broken_rec;
}
if (view->map == view->index->map) {
/* view's mapping is latest. we can use it directly. */
*map_r = view->map;
- *expunged_r = FALSE;
+ if (expunged_r != NULL)
+ *expunged_r = FALSE;
return rec;
}
@@ -205,7 +207,8 @@
if (seq == 0) {
/* everything is expunged from head. use the old record. */
*map_r = view->map;
- *expunged_r = TRUE;
+ if (expunged_r != NULL)
+ *expunged_r = TRUE;
return rec;
}
@@ -222,12 +225,14 @@
returned record doesn't get invalidated after next sync. */
mail_index_view_ref_map(view, view->index->map);
*map_r = view->index->map;
- *expunged_r = FALSE;
+ if (expunged_r != NULL)
+ *expunged_r = FALSE;
return head_rec;
} else {
/* expuned from head. use the old record. */
*map_r = view->map;
- *expunged_r = TRUE;
+ if (expunged_r != NULL)
+ *expunged_r = TRUE;
return rec;
}
}
@@ -334,10 +339,9 @@
{
struct mail_index_map *map;
const void *data;
- bool expunged;
mail_index_lookup_ext_full(view, seq, view->index->keywords_ext_id,
- &map, &data, &expunged);
+ &map, &data, NULL);
mail_index_data_lookup_keywords(map, data, keyword_idx);
}
@@ -442,9 +446,7 @@
mail_index_lookup_full(struct mail_index_view *view, uint32_t seq,
struct mail_index_map **map_r)
{
- bool expunged;
-
- return view->v.lookup_full(view, seq, map_r, &expunged);
+ return view->v.lookup_full(view, seq, map_r, NULL);
}
bool mail_index_is_expunged(struct mail_index_view *view, uint32_t seq)
More information about the dovecot-cvs
mailing list