]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: force-resync now calls optimize on the backend.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Aug 2011 11:13:39 +0000 (14:13 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Aug 2011 11:13:39 +0000 (14:13 +0300)
This mainly works with Lucene backend to recheck what messages actually
exist.

src/plugins/fts/fts-storage.c

index d2b43e12f5f0641d4b5789b198ab737be235f237..e4e18162c2d94c3504a193422b4c221eda65d085 100644 (file)
@@ -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,