]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Log a warning if copying a mail fails unexpectedly
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 1 Feb 2018 21:04:12 +0000 (23:04 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Feb 2018 10:14:13 +0000 (12:14 +0200)
Don't log a warning if it happens because the source message was expunged.
That's an expected failure.

src/doveadm/dsync/dsync-mailbox-import.c

index e02a3fefabbc2f962f6a9d63a16207bec6f88c33..8a3ff6e99164663165ec1b2f7b73f90af0ae0b98 100644 (file)
@@ -2363,6 +2363,15 @@ dsync_msg_try_copy(struct dsync_mailbox_importer *importer,
                if (inst->uid_in_local && !inst->copy_failed &&
                    mail_set_uid(importer->mail, inst->local_uid)) {
                        if (mailbox_copy(save_ctx_p, importer->mail) < 0) {
+                               enum mail_error error;
+                               const char *errstr;
+
+                               errstr = mailbox_get_last_internal_error(importer->box, &error);
+                               if (error != MAIL_ERROR_EXPUNGED) {
+                                       i_warning("Failed to copy mail from UID=%u: "
+                                                 "%s - falling back to other means",
+                                                inst->local_uid, errstr);
+                               }
                                inst->copy_failed = TRUE;
                                return -1;
                        }
@@ -2429,6 +2438,15 @@ dsync_mailbox_save_body(struct dsync_mailbox_importer *importer,
                if (mailbox_copy(&save_ctx, mail->input_mail) == 0)
                        ret = 1;
                else {
+                       enum mail_error error;
+                       const char *errstr;
+
+                       errstr = mailbox_get_last_internal_error(importer->box, &error);
+                       if (error != MAIL_ERROR_EXPUNGED) {
+                               i_warning("Failed to copy source UID=%u mail: "
+                                         "%s - falling back to regular saving",
+                                         mail->input_mail->uid, errstr);
+                       }
                        ret = -1;
                        save_ctx = dsync_mailbox_save_init(importer, mail, newmail);
                }