dovecot: Fixed index reopen check to work more correctly when sy...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jan 11 04:49:58 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/0734af67ca99
changeset: 7144:0734af67ca99
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jan 11 04:42:37 2008 +0200
description:
Fixed index reopen check to work more correctly when syncing view/head.

diffstat:

1 file changed, 4 insertions(+), 4 deletions(-)
src/lib-index/mail-index-sync-update.c |    8 ++++----

diffs (28 lines):

diff -r 81d7093fb892 -r 0734af67ca99 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Fri Jan 11 04:41:30 2008 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Fri Jan 11 04:42:37 2008 +0200
@@ -692,6 +692,8 @@ int mail_index_sync_map(struct mail_inde
 		return 0;
 	}
 
+	start_offset = type == MAIL_INDEX_SYNC_HANDLER_FILE ?
+		map->hdr.log_file_tail_offset : map->hdr.log_file_head_offset;
 	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.
@@ -713,13 +715,11 @@ int mail_index_sync_map(struct mail_inde
 		/* this isn't necessary correct currently, but it should be
 		   close enough */
 		log_size = index->log->head->last_size;
-		if (log_size > map->hdr.log_file_tail_offset &&
-		    log_size - map->hdr.log_file_tail_offset > index_size)
+		if (log_size > start_offset &&
+		    log_size - start_offset > index_size)
 			return 0;
 	}
 
-	start_offset = type == MAIL_INDEX_SYNC_HANDLER_FILE ?
-		map->hdr.log_file_tail_offset : map->hdr.log_file_head_offset;
 	view = mail_index_view_open_with_map(index, map);
 	ret = mail_transaction_log_view_set(view->log_view,
 					    map->hdr.log_file_seq, start_offset,


More information about the dovecot-cvs mailing list