From: Timo Sirainen Date: Wed, 29 Sep 2010 16:14:22 +0000 (+0100) Subject: lib-index: Avoid refreshing transaction log immediately after it was opened. X-Git-Tag: 2.0.5~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c72b9bc9fd67b4492d6e949f54a3964dcb26344;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Avoid refreshing transaction log immediately after it was opened. --- diff --git a/src/lib-index/mail-index.c b/src/lib-index/mail-index.c index afb91f1f01..2d0b81237f 100644 --- a/src/lib-index/mail-index.c +++ b/src/lib-index/mail-index.c @@ -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); diff --git a/src/lib-index/mail-transaction-log.c b/src/lib-index/mail-transaction-log.c index b455f52076..6a7ec71cef 100644 --- a/src/lib-index/mail-transaction-log.c +++ b/src/lib-index/mail-transaction-log.c @@ -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;