[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.51, 1.52

cras at dovecot.org cras at dovecot.org
Sun Aug 22 13:05:09 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv3533/lib-index

Modified Files:
	mail-transaction-log.c 
Log Message:
Optimization for setting initial sync_offset from index.



Index: mail-transaction-log.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- mail-transaction-log.c	22 Aug 2004 06:30:55 -0000	1.51
+++ mail-transaction-log.c	22 Aug 2004 10:05:07 -0000	1.52
@@ -477,6 +477,14 @@
 		return NULL;
 	}
 
+	if (file->hdr.file_seq == log->index->map->log_file_seq &&
+	    log->index->map->log_file_offset != 0) {
+		/* we can get a valid log offset from index file. initialize
+		   sync_offset from it so we don't have to read the whole log
+		   file from beginning. */
+		file->sync_offset = log->index->map->log_file_offset;
+	}
+
 	for (p = &log->tail; *p != NULL; p = &(*p)->next) {
 		if ((*p)->hdr.file_seq >= file->hdr.file_seq) {
 			/* log replaced with file having same sequence as
@@ -1274,9 +1282,8 @@
 		}
 	}
 
-	if (ret < 0) {
+	if (ret < 0)
 		file->sync_offset = append_offset;
-	}
 
 	*log_file_seq_r = file->hdr.file_seq;
 	*log_file_offset_r = file->sync_offset;



More information about the dovecot-cvs mailing list