dovecot-1.2: mail_index_transaction_get_next_uid() shouldn't sor...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jan 22 01:29:47 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/735001110846
changeset: 8672:735001110846
user: Timo Sirainen <tss at iki.fi>
date: Wed Jan 21 18:29:44 2009 -0500
description:
mail_index_transaction_get_next_uid() shouldn't sort appends. They may still be modified!
Fixes a dbox rebuild bug.
diffstat:
2 files changed, 6 insertions(+), 9 deletions(-)
src/lib-index/mail-index-transaction-private.h | 1 +
src/lib-index/mail-index-transaction.c | 14 +++++---------
diffs (49 lines):
diff -r 92fa46fc86f8 -r 735001110846 src/lib-index/mail-index-transaction-private.h
--- a/src/lib-index/mail-index-transaction-private.h Wed Jan 21 16:51:58 2009 -0500
+++ b/src/lib-index/mail-index-transaction-private.h Wed Jan 21 18:29:44 2009 -0500
@@ -37,6 +37,7 @@ struct mail_index_transaction {
mail_index_transaction_reset() to reset it. */
ARRAY_DEFINE(appends, struct mail_index_record);
uint32_t first_new_seq, last_new_seq;
+ uint32_t highest_append_uid;
/* lowest/highest sequence that updates flags/keywords */
uint32_t min_flagupdate_seq, max_flagupdate_seq;
diff -r 92fa46fc86f8 -r 735001110846 src/lib-index/mail-index-transaction.c
--- a/src/lib-index/mail-index-transaction.c Wed Jan 21 16:51:58 2009 -0500
+++ b/src/lib-index/mail-index-transaction.c Wed Jan 21 18:29:44 2009 -0500
@@ -537,8 +537,7 @@ uint32_t mail_index_transaction_get_next
uint32_t mail_index_transaction_get_next_uid(struct mail_index_transaction *t)
{
const struct mail_index_header *head_hdr, *hdr;
- const struct mail_index_record *recs;
- unsigned int count, offset;
+ unsigned int offset;
uint32_t next_uid;
head_hdr = &t->view->index->map->hdr;
@@ -547,13 +546,8 @@ uint32_t mail_index_transaction_get_next
1 : hdr->next_uid;
if (array_is_created(&t->appends)) {
/* get next_uid from appends if they have UIDs */
- mail_index_transaction_sort_appends(t);
-
- recs = array_get(&t->appends, &count);
- if (count > 0 && recs[count-1].uid != 0) {
- i_assert(recs[count-1].uid >= next_uid);
- next_uid = recs[count-1].uid + 1;
- }
+ i_assert(next_uid <= t->highest_append_uid);
+ next_uid = t->highest_append_uid;
}
/* see if it's been updated in pre/post header changes */
@@ -677,6 +671,8 @@ void mail_index_append(struct mail_index
else if (rec->uid == uid)
i_panic("Duplicate UIDs added in transaction");
}
+ if (t->highest_append_uid < uid)
+ t->highest_append_uid = uid;
}
}
More information about the dovecot-cvs
mailing list