[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dovecot-cvs
Subject:    dovecot: If transaction log is deleted under us, recreate it imm...
From:       dovecot () dovecot ! org (dovecot at dovecot ! org)
Date:       2007-08-27 16:13:52
Message-ID: hg.b8b02d155599.1188231232.558208662 () syksy ! dovecot ! org
[Download RAW message or body]

details:   http://hg.dovecot.org/dovecot/rev/b8b02d155599
changeset: 6327:b8b02d155599
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 27 19:12:59 2007 +0300
description:
If transaction log is deleted under us, recreate it immediately.

diffstat:

1 file changed, 9 insertions(+), 1 deletion(-)
src/lib-index/mail-transaction-log.c |   10 +++++++++-

diffs (20 lines):

diff -r 3d7b93aef6b3 -r b8b02d155599 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:12:18 2007 +0300
+++ b/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:12:59 2007 +0300
@@ -277,7 +277,15 @@ static int mail_transaction_log_refresh(
 							  "stat()");
 			return -1;
 		}
-		return -1;
+		/* the file should always exist at this point. if it doesn't,
+		   someone deleted it manually while the index was open. try to
+		   handle this nicely by creating a new log file. */
+		file = log->head;
+		if (mail_transaction_log_create(log) < 0)
+			return -1;
+		i_assert(file->refcount > 0);
+		file->refcount--;
+		return 0;
 	} else {
 		if (log->head->st_ino == st.st_ino &&
 		    CMP_DEV_T(log->head->st_dev, st.st_dev)) {

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic