dovecot-2.2: dsync: Don't try to sync with GUIDs if we can't set...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 20 02:01:13 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/c6fee677172a
changeset: 16376:c6fee677172a
user: Timo Sirainen <tss at iki.fi>
date: Mon May 20 02:01:02 2013 +0300
description:
dsync: Don't try to sync with GUIDs if we can't set them on the needed side.
With two-way syncing both sides need to have writable GUIDs. With one-way
syncing only the writing side needs to have writable GUIDs.
diffstat:
src/doveadm/dsync/dsync-brain-mailbox.c | 11 +++++++----
src/doveadm/dsync/dsync-ibc-stream.c | 6 +++++-
src/doveadm/dsync/dsync-mailbox.h | 2 +-
3 files changed, 13 insertions(+), 6 deletions(-)
diffs (77 lines):
diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c Mon May 20 01:52:25 2013 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c Mon May 20 02:01:02 2013 +0300
@@ -173,8 +173,9 @@
import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_REVERT_LOCAL_CHANGES;
if (brain->debug)
import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_DEBUG;
- if (brain->local_dsync_box.have_guids &&
- remote_dsync_box->have_guids)
+ if (brain->local_dsync_box.have_save_guids &&
+ (remote_dsync_box->have_save_guids ||
+ (brain->backup_recv && remote_dsync_box->have_guids)))
import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_MAILS_HAVE_GUIDS;
brain->box_importer = brain->backup_send ? NULL :
@@ -216,8 +217,9 @@
if (!brain->mail_requests)
exporter_flags |= DSYNC_MAILBOX_EXPORTER_FLAG_AUTO_EXPORT_MAILS;
- if (brain->local_dsync_box.have_guids &&
- remote_dsync_box->have_guids)
+ if (remote_dsync_box->have_save_guids &&
+ (brain->local_dsync_box.have_save_guids ||
+ (brain->backup_send && brain->local_dsync_box.have_guids)))
exporter_flags |= DSYNC_MAILBOX_EXPORTER_FLAG_MAILS_HAVE_GUIDS;
brain->box_exporter = brain->backup_recv ? NULL :
@@ -303,6 +305,7 @@
dsync_box_r->highest_pvt_modseq = status.highest_pvt_modseq;
dsync_box_r->cache_fields = *metadata.cache_fields;
dsync_box_r->have_guids = status.have_guids;
+ dsync_box_r->have_save_guids = status.have_save_guids;
return 1;
}
diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-ibc-stream.c
--- a/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 01:52:25 2013 +0300
+++ b/src/doveadm/dsync/dsync-ibc-stream.c Mon May 20 02:01:02 2013 +0300
@@ -96,7 +96,7 @@
.chr = 'B',
.required_keys = "mailbox_guid uid_validity uid_next messages_count "
"first_recent_uid highest_modseq highest_pvt_modseq",
- .optional_keys = "mailbox_lost cache_fields have_guids"
+ .optional_keys = "mailbox_lost cache_fields have_guids have_save_guids"
},
{ .name = "mailbox_attribute",
.chr = 'A',
@@ -1110,6 +1110,8 @@
dsync_serializer_encode_add(encoder, "mailbox_lost", "");
if (dsync_box->have_guids)
dsync_serializer_encode_add(encoder, "have_guids", "");
+ if (dsync_box->have_save_guids)
+ dsync_serializer_encode_add(encoder, "have_save_guids", "");
dsync_serializer_encode_add(encoder, "uid_validity",
dec2str(dsync_box->uid_validity));
dsync_serializer_encode_add(encoder, "uid_next",
@@ -1210,6 +1212,8 @@
box->mailbox_lost = TRUE;
if (dsync_deserializer_decode_try(decoder, "have_guids", &value))
box->have_guids = TRUE;
+ if (dsync_deserializer_decode_try(decoder, "have_save_guids", &value))
+ box->have_save_guids = TRUE;
value = dsync_deserializer_decode_get(decoder, "uid_validity");
if (str_to_uint32(value, &box->uid_validity) < 0) {
dsync_ibc_input_error(ibc, decoder, "Invalid uid_validity");
diff -r 096054ae8584 -r c6fee677172a src/doveadm/dsync/dsync-mailbox.h
--- a/src/doveadm/dsync/dsync-mailbox.h Mon May 20 01:52:25 2013 +0300
+++ b/src/doveadm/dsync/dsync-mailbox.h Mon May 20 02:01:02 2013 +0300
@@ -8,7 +8,7 @@
struct dsync_mailbox {
guid_128_t mailbox_guid;
bool mailbox_lost;
- bool have_guids;
+ bool have_guids, have_save_guids;
uint32_t uid_validity, uid_next, messages_count, first_recent_uid;
uint64_t highest_modseq, highest_pvt_modseq;
More information about the dovecot-cvs
mailing list