[dovecot-cvs] dovecot/src/lib-index mail-index-view-sync.c, 1.62, 1.63

tss at dovecot.org tss at dovecot.org
Sat Mar 10 19:03:17 EET 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv6334

Modified Files:
	mail-index-view-sync.c 
Log Message:
We skipped some external transactions that shouldn't have been skipped.
The logic for figuring out if flags are unreliable was also a bit broken.



Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- mail-index-view-sync.c	23 Jan 2007 16:10:58 -0000	1.62
+++ mail-index-view-sync.c	10 Mar 2007 17:03:15 -0000	1.63
@@ -224,6 +224,13 @@
 }
 #endif
 
+#define VIEW_IS_SYNCED_TO_SAME(view, hdr) \
+	((hdr)->log_file_seq == (view)->log_file_seq && \
+	 (hdr)->log_file_int_offset == (view)->log_file_offset && \
+	 (hdr)->log_file_ext_offset == (view)->log_file_offset && \
+	 (!array_is_created(&view->syncs_done) || \
+	  array_count(&view->syncs_done) == 0))
+
 int mail_index_view_sync_begin(struct mail_index_view *view,
                                enum mail_index_sync_type sync_mask,
 			       struct mail_index_view_sync_ctx **ctx_r)
@@ -314,9 +321,7 @@
 				view->map->hdr = *hdr;
 			}
 			ctx->sync_map_ctx.unreliable_flags =
-				!(hdr->log_file_seq == view->log_file_seq &&
-				  hdr->log_file_int_offset ==
-				  view->log_file_offset);
+				!VIEW_IS_SYNCED_TO_SAME(view, hdr);
 
 			/* Copy only the mails that we see currently, since
 			   we're going to append the new ones when we see
@@ -326,8 +331,11 @@
 			view->map->records_count = view->hdr.messages_count;
 
 #ifdef DEBUG
-			if (!ctx->sync_map_ctx.unreliable_flags)
+			if (!ctx->sync_map_ctx.unreliable_flags) {
+				i_assert(view->map->hdr.messages_count ==
+					 view->hdr.messages_count);
 				mail_index_view_check(view);
+			}
 #endif
 		}
 
@@ -385,7 +393,7 @@
 	uint32_t seq;
 	uoff_t offset;
 	int ret;
-	bool skipped, synced_to_map;
+	bool skipped;
 
 	for (;;) {
 		/* Get the next transaction from log. */
@@ -431,15 +439,9 @@
 							       offset);
 		}
 
-		/* view->log_file_offset contains the minimum of
-		   int/ext offsets. */
-		synced_to_map = offset < view->hdr.log_file_ext_offset &&
-			seq == view->hdr.log_file_seq &&
-			(ctx->hdr->type & MAIL_TRANSACTION_EXTERNAL) != 0;
-
 		/* Apply transaction to view's mapping if needed (meaning we
 		   didn't just re-map the view to head mapping). */
-		if (ctx->sync_map_update && !synced_to_map) {
+		if (ctx->sync_map_update) {
 			i_assert((ctx->hdr->type &
 				  MAIL_TRANSACTION_EXPUNGE) == 0);
 



More information about the dovecot-cvs mailing list