dovecot: If a forced syncing fails, it could be because of broke...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 19 15:23:21 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/1af7024361e9
changeset: 5774:1af7024361e9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 19 15:23:18 2007 +0300
description:
If a forced syncing fails, it could be because of broken log file position.
If it happens, fsck the index.

diffstat:

1 file changed, 8 insertions(+), 3 deletions(-)
src/lib-index/mail-index-sync-update.c |   11 ++++++++---

diffs (21 lines):

diff -r 622ab4de7d66 -r 1af7024361e9 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Tue Jun 19 15:20:13 2007 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Tue Jun 19 15:23:18 2007 +0300
@@ -710,9 +710,14 @@ int mail_index_sync_map(struct mail_inde
 	start_offset = type == MAIL_INDEX_SYNC_HANDLER_FILE ?
 		map->hdr.log_file_tail_offset : map->hdr.log_file_head_offset;
 	view = mail_index_view_open_with_map(index, map);
-	if (mail_transaction_log_view_set(view->log_view,
-					  map->hdr.log_file_seq, start_offset,
-					  (uint32_t)-1, (uoff_t)-1) <= 0) {
+	ret = mail_transaction_log_view_set(view->log_view,
+					    map->hdr.log_file_seq, start_offset,
+					    (uint32_t)-1, (uoff_t)-1);
+	if (ret <= 0) {
+		if (force && ret == 0) {
+			/* the seq/offset is probably broken */
+			(void)mail_index_fsck(index);
+		}
 		/* can't use it. sync by re-reading index. */
 		mail_index_view_close(&view);
 		return 0;


More information about the dovecot-cvs mailing list