dovecot: If we notice that dovecot.index.log gets deleted, make ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 27 19:34:21 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/081fd0acddd2
changeset: 6331:081fd0acddd2
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 27 19:34:17 2007 +0300
description:
If we notice that dovecot.index.log gets deleted, make sure that
dovecot.index gets written in next sync in case it was also deleted.

diffstat:

3 files changed, 5 insertions(+), 1 deletion(-)
src/lib-index/mail-index-private.h   |    1 +
src/lib-index/mail-index-sync.c      |    4 +++-
src/lib-index/mail-transaction-log.c |    1 +

diffs (37 lines):

diff -r 438346345893 -r 081fd0acddd2 src/lib-index/mail-index-private.h
--- a/src/lib-index/mail-index-private.h	Mon Aug 27 19:14:46 2007 +0300
+++ b/src/lib-index/mail-index-private.h	Mon Aug 27 19:34:17 2007 +0300
@@ -214,6 +214,7 @@ struct mail_index {
 	unsigned int readonly:1;
 	unsigned int fsck:1;
 	unsigned int mapping:1;
+	unsigned int need_recreate:1;
 };
 
 extern struct mail_index_module_register mail_index_module_register;
diff -r 438346345893 -r 081fd0acddd2 src/lib-index/mail-index-sync.c
--- a/src/lib-index/mail-index-sync.c	Mon Aug 27 19:14:46 2007 +0300
+++ b/src/lib-index/mail-index-sync.c	Mon Aug 27 19:34:17 2007 +0300
@@ -613,8 +613,10 @@ int mail_index_sync_commit(struct mail_i
 	want_rotate = mail_transaction_log_want_rotate(index->log);
 	diff = index->map->hdr.log_file_tail_offset -
 		index->last_read_log_file_tail_offset;
-	if (ret == 0 && (diff > 1024 || want_rotate))
+	if (ret == 0 && (diff > 1024 || want_rotate || index->need_recreate)) {
+		index->need_recreate = FALSE;
 		mail_index_write(index, want_rotate);
+	}
 	mail_index_sync_end(_ctx);
 	return ret;
 }
diff -r 438346345893 -r 081fd0acddd2 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:14:46 2007 +0300
+++ b/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:34:17 2007 +0300
@@ -285,6 +285,7 @@ static int mail_transaction_log_refresh(
 			return -1;
 		i_assert(file->refcount > 0);
 		file->refcount--;
+		log->index->need_recreate = TRUE;
 		return 0;
 	} else {
 		if (log->head->st_ino == st.st_ino &&


More information about the dovecot-cvs mailing list