[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync.c, 1.165, 1.166

cras at dovecot.org cras at dovecot.org
Sat Jul 23 11:21:54 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv5410/lib-storage/index/mbox

Modified Files:
	mbox-sync.c 
Log Message:
Error handling fix, more debugging and a new assert



Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- mbox-sync.c	4 Jul 2005 11:32:28 -0000	1.165
+++ mbox-sync.c	23 Jul 2005 08:21:51 -0000	1.166
@@ -257,6 +257,7 @@
 			mail_storage_set_index_error(&sync_ctx->mbox->ibox);
 			return -1;
 		}
+		i_assert(ret != 0); /* we should be looking at head index */
 
 		if (uid <= rec->uid)
 			break;
@@ -267,18 +268,20 @@
 		rec = NULL;
 	}
 
-	if (ret == 0 && uid < sync_ctx->idx_next_uid) {
+	if (rec == NULL && uid < sync_ctx->idx_next_uid) {
 		/* this UID was already in index and it was expunged */
 		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
 			"mbox sync: Expunged message reappeared in mailbox %s "
-			"(UID %u < %u)", sync_ctx->mbox->path, uid,
-			sync_ctx->idx_next_uid);
+			"(UID %u < %u, seq=%u, idx_msgs=%u)",
+			sync_ctx->mbox->path, uid, sync_ctx->idx_next_uid,
+			sync_ctx->seq, messages_count);
 		ret = 0; rec = NULL;
 	} else if (rec != NULL && rec->uid != uid) {
 		/* new UID in the middle of the mailbox - shouldn't happen */
 		mail_storage_set_critical(STORAGE(sync_ctx->mbox->storage),
 			"mbox sync: UID inserted in the middle of mailbox %s "
-			"(%u > %u)", sync_ctx->mbox->path, rec->uid, uid);
+			"(%u > %u, seq=%u, idx_msgs=%u)", sync_ctx->mbox->path,
+			rec->uid, uid, sync_ctx->seq, messages_count);
 		ret = 0; rec = NULL;
 	} else {
 		ret = 1;



More information about the dovecot-cvs mailing list