Mercurial > dovecot > core-2.2
changeset 15262:b0a6fe3aa61f
lib-index: Avoid assert-crashing when syncing an old "keyword reset" from transaction log.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 29 Oct 2012 12:43:29 +0200 |
parents | 4d0d3cc20bdb |
children | 1a3348e3892f |
files | src/lib-index/mail-index-transaction-update.c |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-update.c Mon Oct 29 12:40:14 2012 +0200 +++ b/src/lib-index/mail-index-transaction-update.c Mon Oct 29 12:43:29 2012 +0200 @@ -1014,9 +1014,21 @@ keyword_update_remove_existing(struct mail_index_transaction *t, uint32_t seq) { ARRAY_TYPE(keyword_indexes) keywords; + uint32_t i, keywords_count; t_array_init(&keywords, 32); - mail_index_transaction_lookup_latest_keywords(t, seq, &keywords); + if (t->view->v.lookup_full == NULL) { + /* syncing is saving a list of changes into this transaction. + the seq is actual an uid, so we can't lookup the existing + keywords. we shouldn't get here unless we're reading + pre-v2.2 keyword-reset records from .log files. so we don't + really care about performance that much here, */ + keywords_count = array_count(&t->view->index->keywords); + for (i = 0; i < keywords_count; i++) + array_append(&keywords, &i, 1); + } else { + mail_index_transaction_lookup_latest_keywords(t, seq, &keywords); + } if (array_count(&keywords) == 0) return NULL; return mail_index_keywords_create_from_indexes(t->view->index,