dovecot: If messages are unexpectedly lost from index file, log ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 6 23:56:26 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/700555e06849
changeset: 6714:700555e06849
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 06 23:56:22 2007 +0200
description:
If messages are unexpectedly lost from index file, log an error instead of
assert-crashing.

diffstat:

1 file changed, 11 insertions(+), 2 deletions(-)
src/lib-index/mail-index-view-sync.c |   13 +++++++++++--

diffs (25 lines):

diff -r cfdf3b2e3dd3 -r 700555e06849 src/lib-index/mail-index-view-sync.c
--- a/src/lib-index/mail-index-view-sync.c	Tue Nov 06 23:50:57 2007 +0200
+++ b/src/lib-index/mail-index-view-sync.c	Tue Nov 06 23:56:22 2007 +0200
@@ -321,10 +321,19 @@ int mail_index_view_sync_begin(struct ma
 	}
 
 	if (sync_expunges || !view_sync_have_expunges(view)) {
+		if (view->index->map->hdr.messages_count <
+		    ctx->finish_min_msg_count) {
+			mail_index_set_error(view->index,
+				"Index %s lost messages without expunging "
+				"(%u -> %u)", view->index->filepath,
+				view->map->hdr.messages_count,
+				view->index->map->hdr.messages_count);
+			ctx->finish_min_msg_count = 0;
+			view->inconsistent = TRUE;
+		}
+
 		view->sync_new_map = view->index->map;
 		view->sync_new_map->refcount++;
-		i_assert(view->index->map->hdr.messages_count >=
-			 ctx->finish_min_msg_count);
 
 		/* keep the old mapping without expunges until we're
 		   fully synced */


More information about the dovecot-cvs mailing list