changeset 7143:81d7093fb892 HEAD

If mmap_disable=yes, don't reopen index file unless we really have to, because it causes cache sync to get lost.
author Timo Sirainen <tss@iki.fi>
date Fri, 11 Jan 2008 04:41:30 +0200
parents 58cb2c6f90c7
children 0734af67ca99
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Thu Jan 10 14:15:49 2008 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Fri Jan 11 04:41:30 2008 +0200
@@ -687,14 +687,18 @@
 
 	i_assert(index->map == map || type == MAIL_INDEX_SYNC_HANDLER_VIEW);
 
-	if (!force) {
+	if (index->log->head == NULL) {
+		i_assert(!force);
+		return 0;
+	}
+
+	if (!force && !index->mmap_disable) {
 		/* see if we'd prefer to reopen the index file instead of
-		   syncing the current map from the transaction log */
+		   syncing the current map from the transaction log.
+		   don't check this if mmap is disabled, because reopening
+		   index causes sync to get lost. */
 		uoff_t log_size, index_size;
 
-		if (index->log->head == NULL)
-			return 0;
-
 		if (index->fd == -1 &&
 		    index->log->head->hdr.prev_file_seq != 0) {
 			/* we don't know the index's size, so use the