changeset 8136:285f636884dc HEAD

Don't give bogus "log_file_tail_offset shrank" errors.
author Timo Sirainen <tss@iki.fi>
date Sun, 31 Aug 2008 11:50:27 +0300
parents 0be9c476acdd
children b2a258213ee0
files src/lib-index/mail-transaction-log-file.c src/lib-index/mail-transaction-log-private.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c	Sun Aug 31 11:49:47 2008 +0300
+++ b/src/lib-index/mail-transaction-log-file.c	Sun Aug 31 11:50:27 2008 +0300
@@ -146,6 +146,7 @@
 		file->sync_highest_modseq = modseq_hdr->highest_modseq;
 	}
 	file->saved_tail_offset = log->index->map->hdr.log_file_tail_offset;
+	file->saved_tail_sync_offset = file->saved_tail_offset;
 }
 
 static void
@@ -767,6 +768,12 @@
 		       sizeof(sync_offset));
 
 		if (sync_offset < file->saved_tail_offset) {
+			if (file->sync_offset < file->saved_tail_sync_offset) {
+				/* saved_tail_offset was already set in header,
+				   but we still had to resync the file to find
+				   modseqs. ignore this record. */
+				return 1;
+			}
 			mail_transaction_log_file_set_corrupted(file,
 				"log_file_tail_offset shrank");
 			return -1;
--- a/src/lib-index/mail-transaction-log-private.h	Sun Aug 31 11:49:47 2008 +0300
+++ b/src/lib-index/mail-transaction-log-private.h	Sun Aug 31 11:50:27 2008 +0300
@@ -59,6 +59,9 @@
 	   max_tail_offset automatically by making it skip external transactions
 	   after the last saved offset (to avoid re-reading them unneededly). */
 	uoff_t saved_tail_offset, max_tail_offset;
+	/* don't give warnings about saved_tail_offset shrinking if
+	   sync_offset is less than this. */
+	uoff_t saved_tail_sync_offset;
 
 	struct modseq_cache modseq_cache[LOG_FILE_MODSEQ_CACHE_SIZE];