dovecot-2.2: dsync: When syncing locally, mailbox_copy() the mai...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jan 28 13:56:30 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/d3cda5a567be
changeset: 15676:d3cda5a567be
user: Timo Sirainen <tss at iki.fi>
date: Mon Jan 28 13:56:24 2013 +0200
description:
dsync: When syncing locally, mailbox_copy() the mail to attempt a fast copy.
diffstat:
src/doveadm/dsync/dsync-ibc-pipe.c | 2 ++
src/doveadm/dsync/dsync-mail.h | 6 ++++++
src/doveadm/dsync/dsync-mailbox-export.c | 2 ++
src/doveadm/dsync/dsync-mailbox-import.c | 11 +++++++++++
4 files changed, 21 insertions(+), 0 deletions(-)
diffs (61 lines):
diff -r ceb75581cfcb -r d3cda5a567be src/doveadm/dsync/dsync-ibc-pipe.c
--- a/src/doveadm/dsync/dsync-ibc-pipe.c Mon Jan 28 13:48:09 2013 +0200
+++ b/src/doveadm/dsync/dsync-ibc-pipe.c Mon Jan 28 13:56:24 2013 +0200
@@ -416,6 +416,8 @@
item->u.mail.input = mail->input;
i_stream_ref(mail->input);
}
+ item->u.mail.input_mail = mail->input_mail;
+ item->u.mail.input_mail_uid = mail->input_mail_uid;
}
static enum dsync_ibc_recv_ret
diff -r ceb75581cfcb -r d3cda5a567be src/doveadm/dsync/dsync-mail.h
--- a/src/doveadm/dsync/dsync-mail.h Mon Jan 28 13:48:09 2013 +0200
+++ b/src/doveadm/dsync/dsync-mail.h Mon Jan 28 13:56:24 2013 +0200
@@ -17,6 +17,12 @@
/* Input stream containing the message text, or NULL if all instances
of the message were already expunged from this mailbox. */
struct istream *input;
+
+ /* If non-NULL, we're syncing within the dsync process using ibc-pipe.
+ This mail can be used to mailbox_copy() the mail. */
+ struct mail *input_mail;
+ /* Verify that this equals to input_mail->uid */
+ uint32_t input_mail_uid;
};
struct dsync_mail_request {
diff -r ceb75581cfcb -r d3cda5a567be src/doveadm/dsync/dsync-mailbox-export.c
--- a/src/doveadm/dsync/dsync-mailbox-export.c Mon Jan 28 13:48:09 2013 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-export.c Mon Jan 28 13:56:24 2013 +0200
@@ -581,6 +581,8 @@
return -1;
}
+ dmail->input_mail = mail;
+ dmail->input_mail_uid = mail->uid;
if (mail_get_stream(mail, NULL, NULL, &dmail->input) < 0)
return dsync_mail_error(exporter, mail, "body");
diff -r ceb75581cfcb -r d3cda5a567be src/doveadm/dsync/dsync-mailbox-import.c
--- a/src/doveadm/dsync/dsync-mailbox-import.c Mon Jan 28 13:48:09 2013 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-import.c Mon Jan 28 13:56:24 2013 +0200
@@ -1317,6 +1317,17 @@
if (save_ctx == NULL)
save_ctx = dsync_mailbox_save_init(importer, mail, newmail);
}
+ if (ret <= 0 && mail->input_mail != NULL) {
+ /* copy using the source mail */
+ i_assert(mail->input_mail->uid == mail->input_mail_uid);
+ if (mailbox_copy(&save_ctx, mail->input_mail) == 0)
+ ret = 1;
+ else {
+ ret = -1;
+ save_ctx = dsync_mailbox_save_init(importer, mail, newmail);
+ }
+
+ }
if (ret > 0) {
array_append(&importer->wanted_uids, &newmail->uid, 1);
return;
More information about the dovecot-cvs
mailing list