comparison src/lib-index/mail-index-view-sync.c @ 5303:70fea9bab837 HEAD

View syncing fixes
author Timo Sirainen <tss@iki.fi>
date Wed, 14 Mar 2007 15:49:21 +0200
parents f9b1c0f5bff4
children 965e401fcb7b
comparison
equal deleted inserted replaced
5302:db232a079106 5303:70fea9bab837
450 seq == view->hdr.log_file_seq && 450 seq == view->hdr.log_file_seq &&
451 (ctx->hdr->type & MAIL_TRANSACTION_EXTERNAL) != 0; 451 (ctx->hdr->type & MAIL_TRANSACTION_EXTERNAL) != 0;
452 452
453 /* Apply transaction to view's mapping if needed (meaning we 453 /* Apply transaction to view's mapping if needed (meaning we
454 didn't just re-map the view to head mapping). */ 454 didn't just re-map the view to head mapping). */
455 if (ctx->sync_map_update) { 455 if (ctx->sync_map_update && !synced_to_map) {
456 i_assert((ctx->hdr->type & 456 i_assert((ctx->hdr->type &
457 MAIL_TRANSACTION_EXPUNGE) == 0); 457 MAIL_TRANSACTION_EXPUNGE) == 0);
458 458
459 if (mail_index_sync_record(&ctx->sync_map_ctx, 459 if (mail_index_sync_record(&ctx->sync_map_ctx,
460 ctx->hdr, ctx->data) < 0) 460 ctx->hdr, ctx->data) < 0)
644 view->map = view->sync_new_map; 644 view->map = view->sync_new_map;
645 view->sync_new_map = NULL; 645 view->sync_new_map = NULL;
646 } 646 }
647 647
648 if (ctx->sync_map_update) { 648 if (ctx->sync_map_update) {
649 view->map->hdr.log_file_seq = view->log_file_seq; 649 if (view->log_file_seq != view->map->hdr.log_file_seq) {
650 view->map->hdr.log_file_int_offset = 650 i_assert(view->log_file_seq >
651 view->map->hdr.log_file_seq);
652 view->map->hdr.log_file_seq = view->log_file_seq;
651 view->map->hdr.log_file_ext_offset = 653 view->map->hdr.log_file_ext_offset =
652 view->log_file_offset; 654 view->log_file_offset;
655 } else {
656 i_assert(view->log_file_offset >=
657 view->map->hdr.log_file_int_offset);
658 if (view->log_file_offset >
659 view->map->hdr.log_file_ext_offset) {
660 view->map->hdr.log_file_ext_offset =
661 view->log_file_offset;
662 }
663 }
664 view->map->hdr.log_file_int_offset = view->log_file_offset;
653 } 665 }
654 view->hdr = view->map->hdr; 666 view->hdr = view->map->hdr;
655 667
656 #ifdef DEBUG 668 #ifdef DEBUG
657 if (!view->broken_counters && !ctx->sync_map_ctx.unreliable_flags) 669 if (!view->broken_counters && !ctx->sync_map_ctx.unreliable_flags)