]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_cache_compress_with_trans() - Require that transaction log is locked
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 27 Mar 2020 11:01:57 +0000 (13:01 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:42 +0000 (12:41 +0300)
This should be true now for all of its callers.

src/lib-index/mail-cache-compress.c
src/lib-index/mail-cache.h

index 9d4f0c3334c41366b3b77eb020726b85ec4b9b3c..5225defbbc127f5891d7cf8be25d40797bd60688 100644 (file)
@@ -505,6 +505,7 @@ mail_cache_compress_full(struct mail_cache *cache,
        int ret;
 
        i_assert(!cache->compressing);
+       i_assert(cache->index->log_sync_locked);
 
        *lock_r = NULL;
 
index a01562a2e14ae5fa54a33dfda24cf46a0370a57f..b1ce97cae1d2074909484425b9d1d95a074caa2e 100644 (file)
@@ -67,11 +67,8 @@ mail_cache_register_get_list(struct mail_cache *cache, pool_t pool,
 
 /* Returns TRUE if cache should be compressed. */
 bool mail_cache_need_compress(struct mail_cache *cache);
-/* Compress cache file. Offsets are updated to given transaction. The cache
-   compression lock should be kept until the transaction is committed.
-   mail_cache_compress_unlock() needs to be called afterwards. The lock doesn't
-   prevent updates to the cache while it's held, it only prevents another cache
-   compression.
+/* Compress cache file. Offsets are updated to given transaction.
+   The transaction log must already be exclusively locked.
 
    The cache compression is done only if the current cache file's file_seq
    matches compress_file_seq. The idea is that compression isn't done if