From: Timo Sirainen Date: Sun, 31 Aug 2008 08:50:27 +0000 (+0300) Subject: Don't give bogus "log_file_tail_offset shrank" errors. X-Git-Tag: 1.2.alpha1~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=88b8aea03a24ef7a9efc30399080487b7eb03537;p=thirdparty%2Fdovecot%2Fcore.git Don't give bogus "log_file_tail_offset shrank" errors. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 149c5a9cd1..d9f85def2d 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -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; diff --git a/src/lib-index/mail-transaction-log-private.h b/src/lib-index/mail-transaction-log-private.h index 552ab49d1f..46c1fc5b8c 100644 --- a/src/lib-index/mail-transaction-log-private.h +++ b/src/lib-index/mail-transaction-log-private.h @@ -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];