comparison src/lib-index/mailbox-list-index-sync.c @ 6075:813c976ed476 HEAD

Handle desync errors without marking mailbox list index corrupted, the problem is with mail index.
author Timo Sirainen <tss@iki.fi>
date Wed, 18 Jul 2007 08:37:30 +0300
parents 461496644c67
children 1f0e71c833c3
comparison
equal deleted inserted replaced
6074:47536814b011 6075:813c976ed476
62 62
63 struct ostream *output; 63 struct ostream *output;
64 buffer_t *output_buf; 64 buffer_t *output_buf;
65 65
66 unsigned int failed:1; 66 unsigned int failed:1;
67 unsigned int restart:1;
67 unsigned int partial:1; 68 unsigned int partial:1;
68 unsigned int seen_sync_root:1; 69 unsigned int seen_sync_root:1;
69 }; 70 };
70 71
71 struct mailbox_list_sync_lookup_key { 72 struct mailbox_list_sync_lookup_key {
201 if (mail_index_lookup_uid_range(ctx->mail_view, rec->uid, rec->uid, 202 if (mail_index_lookup_uid_range(ctx->mail_view, rec->uid, rec->uid,
202 &rec->seq, &rec->seq) < 0) 203 &rec->seq, &rec->seq) < 0)
203 return -1; 204 return -1;
204 205
205 if (rec->seq == 0) { 206 if (rec->seq == 0) {
206 return mailbox_list_index_set_corrupted(ctx->index, 207 i_warning("%s: Desync: Record uid=%u expunged from mail index",
207 "Desync: Record expunged from mail index"); 208 ctx->index->mail_index->filepath, rec->uid);
209 ctx->restart = TRUE;
210 return -1;
208 } 211 }
209 return 0; 212 return 0;
210 } 213 }
211 214
212 static int 215 static int
897 offsetof(struct mail_index_header, sync_size), 900 offsetof(struct mail_index_header, sync_size),
898 &used_space, sizeof(used_space), FALSE); 901 &used_space, sizeof(used_space), FALSE);
899 } 902 }
900 903
901 if (ctx->mail_sync_ctx != NULL) { 904 if (ctx->mail_sync_ctx != NULL) {
902 if (ret < 0) 905 if (ret < 0 && !ctx->restart)
903 mail_index_sync_rollback(&ctx->mail_sync_ctx); 906 mail_index_sync_rollback(&ctx->mail_sync_ctx);
904 else { 907 else {
908 if (ctx->restart)
909 mail_index_reset(ctx->trans);
905 if (mail_index_sync_commit(&ctx->mail_sync_ctx) < 0) 910 if (mail_index_sync_commit(&ctx->mail_sync_ctx) < 0)
906 ret = -1; 911 ret = -1;
907 } 912 }
908 } 913 }
909 914