[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.230,1.231
cras at dovecot.org
cras at dovecot.org
Tue May 30 11:26:51 EEST 2006
- Previous message: [dovecot-cvs] dovecot/src/imap cmd-append.c,1.81,1.82
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.16,
1.17 mail-index-sync-keywords.c, 1.9,
1.10 mail-index-sync-private.h, 1.29,
1.30 mail-index-sync-update.c, 1.96, 1.97 mail-index-sync.c,
1.72, 1.73
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv20938
Modified Files:
mail-index.c
Log Message:
If syncing from transaction log fails, fallback to re-reading the index file
(and more importantly, try to avoid crashing in assert..)
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -d -r1.230 -r1.231
--- mail-index.c 2 May 2006 11:04:30 -0000 1.230
+++ mail-index.c 30 May 2006 08:26:48 -0000 1.231
@@ -809,7 +809,7 @@
uoff_t prev_offset, max_offset;
size_t pos;
int ret;
- bool skipped, check_ext_offsets;
+ bool skipped, check_ext_offsets, broken;
if (sync_to_index) {
/* read the real log position where we are supposed to be
@@ -865,7 +865,7 @@
mail_index_sync_map_init(&sync_map_ctx, view,
MAIL_INDEX_SYNC_HANDLER_VIEW);
- check_ext_offsets = TRUE;
+ check_ext_offsets = TRUE; broken = FALSE;
while ((ret = mail_transaction_log_view_next(log_view, &thdr, &tdata,
&skipped)) > 0) {
if ((thdr->type & MAIL_TRANSACTION_EXTERNAL) != 0 &&
@@ -876,10 +876,13 @@
}
if (mail_index_sync_record(&sync_map_ctx, thdr, tdata) < 0) {
- ret = -1;
+ ret = 0;
+ broken = TRUE;
break;
}
}
+ if (ret == 0 && !broken)
+ ret = 1;
mail_transaction_log_view_get_prev_pos(log_view, &prev_seq,
&prev_offset);
@@ -897,7 +900,7 @@
*map = index->map;
index->map = NULL;
- if (sync_to_index) {
+ if (sync_to_index && ret > 0) {
/* make sure we did everything right. note that although the
message counts should be equal, the flag counters may not */
i_assert(hdr.messages_count == (*map)->hdr.messages_count);
@@ -906,7 +909,7 @@
i_assert(hdr.log_file_ext_offset == (*map)->hdr.log_file_ext_offset);
}
- return ret < 0 ? -1 : 1;
+ return ret;
}
static int mail_index_read_map_with_retry(struct mail_index *index,
- Previous message: [dovecot-cvs] dovecot/src/imap cmd-append.c,1.81,1.82
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.16,
1.17 mail-index-sync-keywords.c, 1.9,
1.10 mail-index-sync-private.h, 1.29,
1.30 mail-index-sync-update.c, 1.96, 1.97 mail-index-sync.c,
1.72, 1.73
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list