]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Don't overwrite INUSE error if indexing times out
authorMichael M Slusarz <michael.slusarz@open-xchange.com>
Wed, 22 Sep 2021 20:50:50 +0000 (14:50 -0600)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 2 Dec 2021 11:35:44 +0000 (11:35 +0000)
src/plugins/fts/fts-indexer.c
src/plugins/fts/fts-storage.c

index 769ef7abab31f5fae58e361e59dbe2b45c51c70e..aca23c9c2056b1e1b908e1f68e6f135093f73e1c 100644 (file)
@@ -94,7 +94,10 @@ int fts_indexer_more(struct fts_indexer_context *ctx)
        int ret;
 
        if ((ret = fts_indexer_more_int(ctx)) < 0) {
-               mail_storage_set_internal_error(ctx->box->storage);
+               /* If failed is already set, the code has had a chance to
+                * set an internal error already, i.e. MAIL_ERROR_INUSE. */
+               if (!ctx->failed)
+                       mail_storage_set_internal_error(ctx->box->storage);
                ctx->failed = TRUE;
                return -1;
        }
index 5ecbae58690d87a9f33b0c826b0ddb5cdfee474d..04f2aec738c1ebd38d4e3df16a429afb4995787d 100644 (file)
@@ -391,8 +391,8 @@ static int fts_mailbox_search_deinit(struct mail_search_context *ctx)
                }
                if (fctx->indexing_timed_out)
                        ret = -1;
-               if (!fctx->fts_lookup_success &&
-                   fctx->enforced != FTS_ENFORCED_NO) {
+               else if (!fctx->fts_lookup_success &&
+                        fctx->enforced != FTS_ENFORCED_NO) {
                        /* FTS lookup failed and we didn't want to fallback to
                           opening all the mails and searching manually */
                        mail_storage_set_internal_error(ctx->transaction->box->storage);