]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_cache_set_seq_corrupted_reason() - Don't delete entire cache if trans...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 2 Apr 2020 21:07:23 +0000 (00:07 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:43 +0000 (12:41 +0300)
It can only happen on I/O errors, which most likely means that there's no
disk space to write to transaction log. There's no reason to delete the
entire cache, since it might be expensive to recreate.

src/lib-index/mail-cache.c

index 8afb3e9616718cfe5038bbe038aa99a417a1d779..77f581aaeee2eafea05b13a82396cd03bb5610a5 100644 (file)
@@ -73,10 +73,12 @@ void mail_cache_set_seq_corrupted_reason(struct mail_cache_view *cache_view,
                mail_index_transaction_begin(view, MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);
        mail_index_update_ext(t, seq, cache->ext_id, &empty, NULL);
 
-       if (mail_index_transaction_commit(&t) < 0)
-               mail_cache_reset(cache);
-       else
-               mail_cache_expunge_count(cache, 1);
+       if (mail_index_transaction_commit(&t) < 0) {
+               /* I/O error (e.g. out of disk space). Ignore this for now,
+                  maybe it works again later. */
+               return;
+       }
+       mail_cache_expunge_count(cache, 1);
 }
 
 void mail_cache_file_close(struct mail_cache *cache)