From: Timo Sirainen Date: Thu, 4 Aug 2011 11:13:39 +0000 (+0300) Subject: fts: force-resync now calls optimize on the backend. X-Git-Tag: 2.1.alpha1~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ceae1acc3e3022c6b5fe52a4a34890dffdbcb77f;p=thirdparty%2Fdovecot%2Fcore.git fts: force-resync now calls optimize on the backend. This mainly works with Lucene backend to recheck what messages actually exist. --- diff --git a/src/plugins/fts/fts-storage.c b/src/plugins/fts/fts-storage.c index d2b43e12f5..e4e18162c2 100644 --- a/src/plugins/fts/fts-storage.c +++ b/src/plugins/fts/fts-storage.c @@ -413,13 +413,22 @@ static int fts_sync_deinit(struct mailbox_sync_context *ctx, { 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,