]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't give bogus "log_file_tail_offset shrank" errors.
authorTimo Sirainen <tss@iki.fi>
Sun, 31 Aug 2008 08:50:27 +0000 (11:50 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 31 Aug 2008 08:50:27 +0000 (11:50 +0300)
--HG--
branch : HEAD

src/lib-index/mail-transaction-log-file.c
src/lib-index/mail-transaction-log-private.h

index 149c5a9cd16c4a1b5e2e05ab1819b80319b497f0..d9f85def2db23ba320d01ad2622e4de201e85c93 100644 (file)
@@ -146,6 +146,7 @@ mail_transaction_log_file_skip_to_head(struct mail_transaction_log_file *file)
                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 @@ log_file_track_mailbox_sync_offset_hdr(struct mail_transaction_log_file *file,
                       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;
index 552ab49d1f3f5c48064bb794cdbb7138afc78c58..46c1fc5b8c35ddfa200bc6bded533bca99af4b47 100644 (file)
@@ -59,6 +59,9 @@ struct mail_transaction_log_file {
           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];