From: Timo Sirainen Date: Mon, 30 Mar 2020 15:05:42 +0000 (+0300) Subject: lib-index: mail_cache_compress() - Make sure compression sees the latest changes... X-Git-Tag: 2.3.11.2~411 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d398d4877ea7e35b92ae1d9e39438e168b38e450;p=thirdparty%2Fdovecot%2Fcore.git lib-index: mail_cache_compress() - Make sure compression sees the latest changes in index --- diff --git a/src/lib-index/mail-cache-compress.c b/src/lib-index/mail-cache-compress.c index e260f636b4..9d4f0c3334 100644 --- a/src/lib-index/mail-cache-compress.c +++ b/src/lib-index/mail-cache-compress.c @@ -590,11 +590,15 @@ int mail_cache_compress(struct mail_cache *cache, uint32_t compress_file_seq) &file_seq, &file_offset) < 0) return -1; } + /* make sure we see the latest changes in index */ + ret = mail_index_refresh(cache->index); view = mail_index_view_open(cache->index); trans = mail_index_transaction_begin(view, MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL); - if ((ret = mail_cache_compress_full(cache, trans, compress_file_seq, &lock)) < 0) + if (ret < 0) + ; + else if ((ret = mail_cache_compress_full(cache, trans, compress_file_seq, &lock)) < 0) mail_index_transaction_rollback(&trans); else { if (mail_index_transaction_commit(&trans) < 0)