From: Timo Sirainen Date: Thu, 1 Feb 2018 21:04:12 +0000 (+0200) Subject: dsync: Log a warning if copying a mail fails unexpectedly X-Git-Tag: 2.3.9~2349 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2da20ac5a4af910deebf4312469ba925bb88f432;p=thirdparty%2Fdovecot%2Fcore.git dsync: Log a warning if copying a mail fails unexpectedly Don't log a warning if it happens because the source message was expunged. That's an expected failure. --- diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index e02a3fefab..8a3ff6e991 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -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); }