[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.95,
1.96
cras at dovecot.org
cras at dovecot.org
Wed May 3 22:43:27 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv6659
Modified Files:
mail-index-sync-update.c
Log Message:
When removing recent-flags with mmap_disable, the flags weren't actually
removed which caused broken recent counter errors. Also added more checks
not to update counters if they're already known to be broken.
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- mail-index-sync-update.c 2 May 2006 22:06:32 -0000 1.95
+++ mail-index-sync-update.c 3 May 2006 19:43:25 -0000 1.96
@@ -172,7 +172,7 @@
expunge_handlers_count = 0;
}
- if (ctx->unreliable_flags)
+ if (ctx->unreliable_flags || view->broken_counters)
view->broken_counters = TRUE;
else {
for (seq = seq1; seq <= seq2; seq++) {
@@ -210,6 +210,16 @@
return 1;
}
+static void write_seq_update(struct mail_index_map *map,
+ uint32_t seq1, uint32_t seq2)
+{
+ if (map->write_seq_first == 0 ||
+ map->write_seq_first > seq1)
+ map->write_seq_first = seq1;
+ if (map->write_seq_last < seq2)
+ map->write_seq_last = seq2;
+}
+
static int sync_append(const struct mail_index_record *rec,
struct mail_index_sync_map_ctx *ctx)
{
@@ -244,15 +254,16 @@
map->records_count++;
view->hdr.messages_count++;
- if (map->write_seq_first == 0)
- map->write_seq_first = map->hdr.messages_count;
- map->write_seq_last = map->hdr.messages_count;
+ write_seq_update(map, map->hdr.messages_count, map->hdr.messages_count);
if ((rec->flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0)
map->hdr.flags |= MAIL_INDEX_HDR_FLAG_HAVE_DIRTY;
- mail_index_header_update_counts(view->index, &map->hdr, 0, rec->flags);
- mail_index_header_update_lowwaters(&map->hdr, rec);
+ if (!view->broken_counters) {
+ mail_index_header_update_counts(view->index, &map->hdr,
+ 0, rec->flags);
+ mail_index_header_update_lowwaters(&map->hdr, rec);
+ }
return 1;
}
@@ -279,11 +290,7 @@
if (seq1 == 0)
return 1;
- if (view->map->write_seq_first == 0 ||
- view->map->write_seq_first > seq1)
- view->map->write_seq_first = seq1;
- if (view->map->write_seq_last < seq2)
- view->map->write_seq_last = seq2;
+ write_seq_update(view->map, seq1, seq2);
hdr = &view->map->hdr;
if ((u->add_flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0)
@@ -291,9 +298,10 @@
flag_mask = ~u->remove_flags;
- if (ctx->unreliable_flags &&
- ((u->add_flags | u->remove_flags) &
- (MAIL_SEEN | MAIL_DELETED | MAIL_RECENT)) != 0) {
+ if (view->broken_counters ||
+ (ctx->unreliable_flags &&
+ ((u->add_flags | u->remove_flags) &
+ (MAIL_SEEN | MAIL_DELETED | MAIL_RECENT)) != 0)) {
view->broken_counters = TRUE;
for (idx = seq1-1; idx < seq2; idx++) {
rec = MAIL_INDEX_MAP_IDX(view->map, idx);
@@ -621,8 +629,11 @@
for (i = 0; i < map->records_count; i++) {
rec = MAIL_INDEX_MAP_IDX(map, i);
- if ((rec->flags & MAIL_RECENT) != 0)
+ if ((rec->flags & MAIL_RECENT) != 0) {
rec->flags &= ~MAIL_RECENT;
+
+ write_seq_update(map, i + 1, i + 1);
+ }
}
map->hdr.recent_messages_count = 0;
More information about the dovecot-cvs
mailing list