dovecot-1.1: indexes: Make sure we don't shrink log_file_tail_of...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 6 00:29:43 EET 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/0588009a7317
changeset: 8186:0588009a7317
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 05 17:29:21 2009 -0500
description:
indexes: Make sure we don't shrink log_file_tail_offset.

diffstat:

2 files changed, 7 insertions(+), 1 deletion(-)
src/lib-index/mail-transaction-log-append.c |    1 +
src/lib-index/mail-transaction-log-file.c   |    7 ++++++-

diffs (35 lines):

diff -r 6aaf6a306c94 -r 0588009a7317 src/lib-index/mail-transaction-log-append.c
--- a/src/lib-index/mail-transaction-log-append.c	Thu Mar 05 13:11:16 2009 -0500
+++ b/src/lib-index/mail-transaction-log-append.c	Thu Mar 05 17:29:21 2009 -0500
@@ -503,6 +503,7 @@ static void log_append_sync_offset_if_ne
 
 	if (ctx->file->saved_tail_offset == offset)
 		return;
+	i_assert(offset > ctx->file->saved_tail_offset);
 
 	buf = buffer_create_static_hard(pool_datastack_create(),
 					sizeof(*u) + sizeof(offset));
diff -r 6aaf6a306c94 -r 0588009a7317 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Thu Mar 05 13:11:16 2009 -0500
+++ b/src/lib-index/mail-transaction-log-file.c	Thu Mar 05 17:29:21 2009 -0500
@@ -121,6 +121,8 @@ mail_transaction_log_file_add_to_list(st
 			file->sync_offset = file->hdr.hdr_size;
 		}
 		file->saved_tail_offset = map->hdr.log_file_tail_offset;
+		if (file->saved_tail_offset > file->max_tail_offset)
+			file->max_tail_offset = file->saved_tail_offset;
 	} else {
 		file->sync_offset = file->hdr.hdr_size;
 	}
@@ -686,7 +688,10 @@ log_file_track_mailbox_sync_offset_hdr(s
 
 		if (sync_offset < file->saved_tail_offset) {
 			mail_transaction_log_file_set_corrupted(file,
-				"log_file_tail_offset shrank");
+				"log_file_tail_offset update shrank it "
+				"(%u vs %"PRIuUOFF_T", file_seq=%u)",
+				sync_offset, file->saved_tail_offset,
+				file->hdr.file_seq);
 			return -1;
 		}
 		file->saved_tail_offset = sync_offset;


More information about the dovecot-cvs mailing list