dovecot: Handle desync errors without marking mailbox list index...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 18 09:26:39 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/813c976ed476
changeset: 6075:813c976ed476
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 18 08:37:30 2007 +0300
description:
Handle desync errors without marking mailbox list index corrupted, the
problem is with mail index.

diffstat:

2 files changed, 15 insertions(+), 7 deletions(-)
src/lib-index/mailbox-list-index-sync.c   |   11 ++++++++---
src/lib-storage/list/index-mailbox-list.c |   11 +++++++----

diffs (65 lines):

diff -r 47536814b011 -r 813c976ed476 src/lib-index/mailbox-list-index-sync.c
--- a/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 08:36:55 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 08:37:30 2007 +0300
@@ -64,6 +64,7 @@ struct mailbox_list_index_sync_ctx {
 	buffer_t *output_buf;
 
 	unsigned int failed:1;
+	unsigned int restart:1;
 	unsigned int partial:1;
 	unsigned int seen_sync_root:1;
 };
@@ -203,8 +204,10 @@ mailbox_list_index_sync_get_seq(struct m
 		return -1;
 
 	if (rec->seq == 0) {
-		return mailbox_list_index_set_corrupted(ctx->index,
-			"Desync: Record expunged from mail index");
+		i_warning("%s: Desync: Record uid=%u expunged from mail index",
+			  ctx->index->mail_index->filepath, rec->uid);
+		ctx->restart = TRUE;
+		return -1;
 	}
 	return 0;
 }
@@ -899,9 +902,11 @@ int mailbox_list_index_sync_commit(struc
 	}
 
 	if (ctx->mail_sync_ctx != NULL) {
-		if (ret < 0)
+		if (ret < 0 && !ctx->restart)
 			mail_index_sync_rollback(&ctx->mail_sync_ctx);
 		else {
+			if (ctx->restart)
+				mail_index_reset(ctx->trans);
 			if (mail_index_sync_commit(&ctx->mail_sync_ctx) < 0)
 				ret = -1;
 		}
diff -r 47536814b011 -r 813c976ed476 src/lib-storage/list/index-mailbox-list.c
--- a/src/lib-storage/list/index-mailbox-list.c	Wed Jul 18 08:36:55 2007 +0300
+++ b/src/lib-storage/list/index-mailbox-list.c	Wed Jul 18 08:37:30 2007 +0300
@@ -300,8 +300,9 @@ list_index_get_info_flags(struct index_m
 					&seq, &seq) < 0)
 		return -1;
 	if (seq == 0) {
-		mailbox_list_index_set_corrupted(ilist->list_index,
-			"Desynced: Record expunged from mail index");
+		i_error("Mailbox list index desynced: "
+			"Record uid=%u expunged from mail index", uid);
+		mail_index_mark_corrupted(ilist->mail_index);
 		return -1;
 	}
 
@@ -341,8 +342,10 @@ static int list_index_iter_next(struct i
 
 		if ((ctx->info.flags & MAILBOX_NOCHILDREN) != 0 &&
 		    iinfo.has_children) {
-			mailbox_list_index_set_corrupted(ilist->list_index,
-				"Desynced: Children flags wrong in mail index");
+			i_error("Mailbox list index desynced: "
+				"Children flags for uid=%u wrong in mail index",
+				iinfo.uid);
+			mail_index_mark_corrupted(ilist->mail_index);
 			return -1;
 		}
 


More information about the dovecot-cvs mailing list