changeset 12202:8af455e61dad

lib-index: Avoid refreshing transaction log immediately after it was opened.
author Timo Sirainen <tss@iki.fi>
date Wed, 29 Sep 2010 17:14:22 +0100
parents e140d7aab969
children 49bd77c018bd
files src/lib-index/mail-index.c src/lib-index/mail-transaction-log.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index.c	Wed Sep 29 16:34:56 2010 +0100
+++ b/src/lib-index/mail-index.c	Wed Sep 29 17:14:22 2010 +0100
@@ -527,12 +527,13 @@
 	    (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);
--- a/src/lib-index/mail-transaction-log.c	Wed Sep 29 16:34:56 2010 +0100
+++ b/src/lib-index/mail-transaction-log.c	Wed Sep 29 17:14:22 2010 +0100
@@ -365,6 +365,12 @@
 			   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;