Mercurial > dovecot > core-2.2
changeset 13266:ee151b7e0d5a
lib-index: Optimized handling MAIL_TRANSACTION_EXPUNGE_GUID records in large index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 16 Aug 2011 22:27:06 +0300 |
parents | 2d4175c9ff52 |
children | 1a40ebfedaa2 |
files | src/lib-index/mail-index-sync-update.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c Tue Aug 16 22:26:12 2011 +0300 +++ b/src/lib-index/mail-index-sync-update.c Tue Aug 16 22:27:06 2011 +0300 @@ -552,11 +552,15 @@ case MAIL_TRANSACTION_EXPUNGE_GUID: case MAIL_TRANSACTION_EXPUNGE_GUID|MAIL_TRANSACTION_EXPUNGE_PROT: { const struct mail_transaction_expunge_guid *rec = data, *end; + ARRAY_TYPE(seq_range) uids; + const struct seq_range *range; + unsigned int i, count; if ((hdr->type & MAIL_TRANSACTION_EXTERNAL) == 0) { /* this is simply a request for expunge */ break; } + t_array_init(&uids, 64); end = CONST_PTR_OFFSET(data, hdr->size); for (; rec != end; rec++) { if (rec->uid == 0) { @@ -565,8 +569,13 @@ rec->uid); break; } - sync_expunge(ctx, rec->uid, rec->uid); + seq_range_array_add(&uids, 0, rec->uid); } + + /* do this in reverse so the memmove()s are smaller */ + range = array_get(&uids, &count); + for (i = count; i > 0; i--) + sync_expunge(ctx, range[i-1].seq1, range[i-1].seq2); break; } case MAIL_TRANSACTION_FLAG_UPDATE: {