changeset 13162:216710c3736e

fts: force-resync now calls optimize on the backend. This mainly works with Lucene backend to recheck what messages actually exist.
author Timo Sirainen <tss@iki.fi>
date Thu, 04 Aug 2011 14:13:39 +0300
parents 7481ea45b95f
children 5d17181b1a2e
files src/plugins/fts/fts-storage.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts/fts-storage.c	Thu Aug 04 14:12:56 2011 +0300
+++ b/src/plugins/fts/fts-storage.c	Thu Aug 04 14:13:39 2011 +0300
@@ -413,13 +413,22 @@
 {
 	struct mailbox *box = ctx->box;
 	struct fts_mailbox *fbox = FTS_CONTEXT(box);
-	bool precache;
+	struct fts_mailbox_list *flist = FTS_LIST_CONTEXT(box->list);
+	bool precache, force_resync;
 
 	precache = (ctx->flags & MAILBOX_SYNC_FLAG_PRECACHE) != 0;
+	force_resync = (ctx->flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0;
 	if (fbox->module_ctx.super.sync_deinit(ctx, status_r) < 0)
 		return -1;
 	ctx = NULL;
 
+	if (force_resync) {
+		if (fts_backend_optimize(flist->backend) < 0) {
+			mail_storage_set_critical(box->storage,
+				"FTS optimize for mailbox %s failed",
+				box->vname);
+		}
+	}
 	if (precache) {
 		if (fts_update(box) < 0) {
 			mail_storage_set_critical(box->storage,