Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8672:735001110846 HEAD
mail_index_transaction_get_next_uid() shouldn't sort appends. They may still be modified!
Fixes a dbox rebuild bug.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 21 Jan 2009 18:29:44 -0500 |
parents | 92fa46fc86f8 |
children | 8f1fc77aea7e |
files | src/lib-index/mail-index-transaction-private.h src/lib-index/mail-index-transaction.c |
diffstat | 2 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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;
--- 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_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 @@ 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 @@ else if (rec->uid == uid) i_panic("Duplicate UIDs added in transaction"); } + if (t->highest_append_uid < uid) + t->highest_append_uid = uid; } }