changeset 6924:c46a191a8726 HEAD

If we didn't read tail offset update from transaction log, we set it to 0 in index header, causing a lot of unnecessary work.
author Timo Sirainen <tss@iki.fi>
date Tue, 04 Dec 2007 12:34:43 +0200
parents efd6dfbddf19
children d6dd3fce2817
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Tue Dec 04 11:22:36 2007 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Tue Dec 04 12:34:43 2007 +0200
@@ -803,7 +803,11 @@
 	   besides using header updates, it also updates the offset to skip
 	   over following external transactions to avoid extra unneeded log
 	   reading. */
-	map->hdr.log_file_tail_offset = index->log->head->max_tail_offset;
+	i_assert(map->hdr.log_file_seq == index->log->head->hdr.file_seq);
+	if (map->hdr.log_file_tail_offset < index->log->head->max_tail_offset) {
+		map->hdr.log_file_tail_offset =
+			index->log->head->max_tail_offset;
+	}
 
 	buffer_write(map->hdr_copy_buf, 0, &map->hdr, sizeof(map->hdr));
 	if (!MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {