Skip to content

Commit

Permalink
dsync: Log a warning if copying a mail fails unexpectedly
Browse files Browse the repository at this point in the history
Don't log a warning if it happens because the source message was expunged.
That's an expected failure.
  • Loading branch information
sirainen committed Feb 8, 2018
1 parent 2477c86 commit 2da20ac
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/doveadm/dsync/dsync-mailbox-import.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 2da20ac

Please sign in to comment.