]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Avoid refreshing transaction log immediately after it was opened.
authorTimo Sirainen <tss@iki.fi>
Wed, 29 Sep 2010 16:14:22 +0000 (17:14 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 29 Sep 2010 16:14:22 +0000 (17:14 +0100)
src/lib-index/mail-index.c
src/lib-index/mail-transaction-log.c

index afb91f1f0151a10570139c511b1a7885e8747804..2d0b81237f7f54340ccdbfc3355412292483b669 100644 (file)
@@ -527,12 +527,13 @@ int mail_index_open(struct mail_index *index, enum mail_index_open_flags flags)
            (flags & MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE) == 0)
                i_fatal("nfs flush requires mmap_disable=yes");
 
-       index->open_count++;
        if ((ret = mail_index_open_files(index, flags)) <= 0) {
                /* doesn't exist and create flag not used */
+               index->open_count++;
                mail_index_close(index);
                return ret;
        }
+       index->open_count++;
 
        i_assert(index->map != NULL);
        mail_index_alloc_cache_index_opened(index);
index b455f5207651d0918b522f927102a1416b4f619f..6a7ec71cef3d3eb3c31d4eb5386d8af06feec3ac 100644 (file)
@@ -365,6 +365,12 @@ int mail_transaction_log_find_file(struct mail_transaction_log *log,
                           file exists. */
                        return 0;
                }
+               if (log->index->open_count == 0) {
+                       /* we're opening the index and we just opened the
+                          log file. don't waste time checking if there's a
+                          newer one. */
+                       return 0;
+               }
 
                if (mail_transaction_log_refresh(log, FALSE) < 0)
                        return -1;