[dovecot-cvs] dovecot/src/lib-index mail-index-view-sync.c, 1.52.2.7, 1.52.2.8
tss at dovecot.org
tss at dovecot.org
Sat Mar 10 19:03:14 EET 2007
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv6338
Modified Files:
Tag: branch_1_0
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.52.2.7
retrieving revision 1.52.2.8
diff -u -d -r1.52.2.7 -r1.52.2.8
--- mail-index-view-sync.c 23 Jan 2007 16:10:55 -0000 1.52.2.7
+++ mail-index-view-sync.c 10 Mar 2007 17:03:12 -0000 1.52.2.8
@@ -232,6 +232,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)
@@ -322,9 +329,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
@@ -334,8 +339,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
}
@@ -393,7 +401,7 @@
uint32_t seq;
uoff_t offset;
int ret;
- bool skipped, synced_to_map;
+ bool skipped;
for (;;) {
/* Get the next transaction from log. */
@@ -439,15 +447,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