]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add explicit MAIL_ERROR_LOOKUP_ABORT error
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 18 Feb 2017 03:01:50 +0000 (05:01 +0200)
committerGitLab <gitlab@git.dovecot.net>
Sun, 19 Feb 2017 18:42:32 +0000 (20:42 +0200)
The MAIL_ERROR_NOTPOSSIBLE was a bit too generic to assume to mean the same
thing. It doesn't look like there are any external plugins that break
because of this change.

src/doveadm/doveadm-mail.c
src/imap/imap-commands-util.c
src/lib-storage/index/index-mailbox-size.c
src/lib-storage/index/index-search.c
src/lib-storage/index/index-sort.c
src/lib-storage/mail-error.h
src/lib-storage/mail.c
src/pop3/pop3-client.c

index b4557ab38952d97ca3df36c178441d169db142a0..0fd7f998bb4886793ea93ab126b3c967093f2cc4 100644 (file)
@@ -84,6 +84,8 @@ void doveadm_mail_failed_error(struct doveadm_mail_cmd_context *ctx,
        case MAIL_ERROR_LIMIT:
                exit_code = DOVEADM_EX_NOTPOSSIBLE;
                break;
+       case MAIL_ERROR_LOOKUP_ABORTED:
+               break;
        }
        /* tempfail overrides all other exit codes, otherwise use whatever
           error happened first */
index d724077231c2bcfbe46836c16dee632688303404..39dfb5ae70d9d5c9882781fc3a854bc211e97512 100644 (file)
@@ -141,6 +141,7 @@ imap_get_error_string(struct client_command_context *cmd,
        case MAIL_ERROR_NONE:
                break;
        case MAIL_ERROR_TEMP:
+       case MAIL_ERROR_LOOKUP_ABORTED: /* BUG: shouldn't be visible here */
                resp_code = IMAP_RESP_CODE_SERVERBUG;
                break;
        case MAIL_ERROR_NOTPOSSIBLE:
index 09e9181ae78ebf1390dc693cb8071fed5752ce30..c365954b652c548c9466cb98ed4121d1ed95ad5b 100644 (file)
@@ -331,7 +331,7 @@ index_mailbox_vsize_hdr_add_missing(struct mailbox_vsize_update *update,
                }
                ret = mail_get_virtual_size(mail, &vsize);
                if (ret < 0 &&
-                   mailbox_get_last_mail_error(update->box) == MAIL_ERROR_NOTPOSSIBLE) {
+                   mailbox_get_last_mail_error(update->box) == MAIL_ERROR_LOOKUP_ABORTED) {
                        /* abort and finish on background */
                        i_assert(mails_left == 0);
 
index 9729543fd029a7ee5823a5350c8efa99e1f67ca4..c22d57fcf04d221dd5771f0b6e152159749a49d7 100644 (file)
@@ -83,8 +83,8 @@ static void search_cur_mail_failed(struct index_search_context *ctx)
        case MAIL_ERROR_EXPUNGED:
                ctx->mail_ctx.seen_lost_data = TRUE;
                break;
-       case MAIL_ERROR_NOTPOSSIBLE:
-               /* lookup_abort hit */
+       case MAIL_ERROR_LOOKUP_ABORTED:
+               /* expected failure */
                break;
        default:
                search_set_failed(ctx);
index 2f0df428874bd478eb04ef395f05a228d5df7e01..a7cae3b216a811f0f8421de00c0db306db5491b5 100644 (file)
@@ -43,7 +43,7 @@ index_sort_program_set_mail_failed(struct mail_search_sort_program *program,
        switch (mailbox_get_last_mail_error(mail->box)) {
        case MAIL_ERROR_EXPUNGED:
                break;
-       case MAIL_ERROR_NOTPOSSIBLE:
+       case MAIL_ERROR_LOOKUP_ABORTED:
                /* just change the error message */
                mail_storage_set_error(program->t->box->storage, MAIL_ERROR_LIMIT,
                        "Requested sort would have taken too long.");
index 4b111788693d221d48bd510f0c3c1da19c56fe7b..ed0108f5ba9bfda55247b6d878fc0b8ec3c9ff15 100644 (file)
@@ -49,6 +49,9 @@ enum mail_error {
        MAIL_ERROR_INVALIDDATA,
        /* Operation ran against some kind of a limit. */
        MAIL_ERROR_LIMIT,
+       /* Operation couldn't be finished as efficiently as required by
+          mail.lookup_abort. */
+       MAIL_ERROR_LOOKUP_ABORTED,
 };
 
 /* Convert errno to mail_error and an error string. Returns TRUE if successful,
index bfa06c62008628c03f9a855b54ad2580be1d71b4..d48341aea174b1775e3a5542fd35b9ab8c1d0a88 100644 (file)
@@ -247,7 +247,7 @@ int mail_get_header_stream(struct mail *mail,
 
 void mail_set_aborted(struct mail *mail)
 {
-       mail_storage_set_error(mail->box->storage, MAIL_ERROR_NOTPOSSIBLE,
+       mail_storage_set_error(mail->box->storage, MAIL_ERROR_LOOKUP_ABORTED,
                               "Mail field not cached");
 }
 
index 04cc48acc995ff513325ae364574bded0c198eec..2fe964959b59633bf05ae4f7c3b3f7ced2daf6a2 100644 (file)
@@ -97,7 +97,7 @@ pop3_mail_get_size(struct client *client, struct mail *mail, uoff_t *size_r)
        if (ret == 0)
                return 0;
 
-       if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_NOTPOSSIBLE)
+       if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_LOOKUP_ABORTED)
                return -1;
 
        /* virtual size not available with a fast lookup.
@@ -108,7 +108,7 @@ pop3_mail_get_size(struct client *client, struct mail *mail, uoff_t *size_r)
        if (ret == 0)
                return 0;
 
-       if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_NOTPOSSIBLE)
+       if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_LOOKUP_ABORTED)
                return -1;
 
        /* no way to quickly get the size. fallback to doing a slow virtual