dovecot-2.2: fts-lucene: If lucene-indexes dir is unexpectedly l...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 12 09:43:01 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/37eff3debe38
changeset: 17704:37eff3debe38
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 12 12:39:46 2014 +0300
description:
fts-lucene: If lucene-indexes dir is unexpectedly lost, rescan when expunge log update fails.
This mainly fixes a repeating error about failing to open the expunge log.
It should happen only if dovecot.index thinks that the mailbox is indexed
while in reality the entire lucene-indexes directory doesn't exist.

diffstat:

 src/plugins/fts-lucene/fts-backend-lucene.c |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 4968b36d9ac8 -r 37eff3debe38 src/plugins/fts-lucene/fts-backend-lucene.c
--- a/src/plugins/fts-lucene/fts-backend-lucene.c	Mon Aug 11 19:30:15 2014 +0300
+++ b/src/plugins/fts-lucene/fts-backend-lucene.c	Tue Aug 12 12:39:46 2014 +0300
@@ -272,8 +272,18 @@
 	}
 
 	if (ctx->expunge_ctx != NULL) {
-		if (fts_expunge_log_append_commit(&ctx->expunge_ctx) < 0)
+		if (fts_expunge_log_append_commit(&ctx->expunge_ctx) < 0) {
+			struct stat st;
+
+			if (stat(backend->dir_path, &st) < 0 && errno == ENOENT) {
+				/* lucene-indexes directory doesn't even exist,
+				   so dovecot.index's last_index_uid is wrong.
+				   rescan to update them. */
+				(void)lucene_index_rescan(backend->index);
+				ret = 0;
+			}
 			ret = -1;
+		}
 	}
 
 	if (fts_backend_lucene_need_optimize(ctx)) {


More information about the dovecot-cvs mailing list