dovecot-2.0: lib-index: Avoid refreshing transaction log immedia...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 29 19:15:39 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8af455e61dad
changeset: 12202:8af455e61dad
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 29 17:14:22 2010 +0100
description:
lib-index: Avoid refreshing transaction log immediately after it was opened.

diffstat:

 src/lib-index/mail-index.c           |  3 ++-
 src/lib-index/mail-transaction-log.c |  6 ++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r e140d7aab969 -r 8af455e61dad src/lib-index/mail-index.c
--- 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);
diff -r e140d7aab969 -r 8af455e61dad src/lib-index/mail-transaction-log.c
--- 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;


More information about the dovecot-cvs mailing list