dovecot-2.2: dsync: -m '' parameter now syncs mailbox list, but ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Mar 21 14:49:48 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/38774adaddaf
changeset: 16084:38774adaddaf
user: Timo Sirainen <tss at iki.fi>
date: Thu Mar 21 14:48:33 2013 +0200
description:
dsync: -m '' parameter now syncs mailbox list, but no actual mails.
diffstat:
src/doveadm/dsync/doveadm-dsync.c | 4 ++++
src/doveadm/dsync/dsync-brain-mailbox.c | 10 +++++++---
src/doveadm/dsync/dsync-brain-mails.c | 3 +--
src/doveadm/dsync/dsync-brain-private.h | 4 +++-
src/doveadm/dsync/dsync-brain.c | 1 +
src/doveadm/dsync/dsync-brain.h | 5 ++++-
6 files changed, 20 insertions(+), 7 deletions(-)
diffs (103 lines):
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/doveadm-dsync.c Thu Mar 21 14:48:33 2013 +0200
@@ -470,6 +470,10 @@
if (doveadm_debug)
brain_flags |= DSYNC_BRAIN_FLAG_DEBUG;
+ if (ctx->mailbox != NULL && *ctx->mailbox == '\0') {
+ brain_flags |= DSYNC_BRAIN_FLAG_NO_MAIL_SYNC;
+ ctx->mailbox = NULL;
+ }
brain = dsync_brain_master_init(user, ibc, sync_ns, ctx->mailbox,
ctx->sync_type, brain_flags,
ctx->lock_timeout,
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c Thu Mar 21 14:48:33 2013 +0200
@@ -422,9 +422,14 @@
brain->state = DSYNC_STATE_SYNC_MAILS;
}
-bool dsync_boxes_need_sync(const struct dsync_mailbox *box1,
+bool dsync_boxes_need_sync(struct dsync_brain *brain,
+ const struct dsync_mailbox *box1,
const struct dsync_mailbox *box2)
{
+ if (brain->no_mail_sync)
+ return FALSE;
+ if (brain->sync_type != DSYNC_BRAIN_SYNC_TYPE_CHANGED)
+ return TRUE;
return box1->highest_modseq != box2->highest_modseq ||
box1->highest_pvt_modseq != box2->highest_pvt_modseq ||
box1->messages_count != box2->messages_count ||
@@ -631,8 +636,7 @@
dsync_brain_mailbox_update_pre(brain, box, &local_dsync_box, dsync_box);
- if (brain->sync_type == DSYNC_BRAIN_SYNC_TYPE_CHANGED &&
- !dsync_boxes_need_sync(&local_dsync_box, dsync_box)) {
+ if (!dsync_boxes_need_sync(brain, &local_dsync_box, dsync_box)) {
/* no fields appear to have changed, skip this mailbox */
mailbox_free(&box);
return TRUE;
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/dsync-brain-mails.c
--- a/src/doveadm/dsync/dsync-brain-mails.c Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-mails.c Thu Mar 21 14:48:33 2013 +0200
@@ -48,8 +48,7 @@
dsync_brain_mailbox_update_pre(brain, brain->box,
&brain->local_dsync_box, dsync_box);
- if (brain->sync_type == DSYNC_BRAIN_SYNC_TYPE_CHANGED &&
- !dsync_boxes_need_sync(&brain->local_dsync_box, dsync_box)) {
+ if (!dsync_boxes_need_sync(brain, &brain->local_dsync_box, dsync_box)) {
/* no fields appear to have changed, skip this mailbox */
dsync_brain_sync_mailbox_deinit(brain);
return TRUE;
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/dsync-brain-private.h
--- a/src/doveadm/dsync/dsync-brain-private.h Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-private.h Thu Mar 21 14:48:33 2013 +0200
@@ -91,6 +91,7 @@
unsigned int backup_recv:1;
unsigned int debug:1;
unsigned int sync_visible_namespaces:1;
+ unsigned int no_mail_sync:1;
unsigned int changes_during_sync:1;
unsigned int failed:1;
};
@@ -112,7 +113,8 @@
struct mailbox *box,
const struct dsync_mailbox *local_box,
const struct dsync_mailbox *remote_box);
-bool dsync_boxes_need_sync(const struct dsync_mailbox *box1,
+bool dsync_boxes_need_sync(struct dsync_brain *brain,
+ const struct dsync_mailbox *box1,
const struct dsync_mailbox *box2);
void dsync_brain_sync_init_box_states(struct dsync_brain *brain);
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/dsync-brain.c
--- a/src/doveadm/dsync/dsync-brain.c Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain.c Thu Mar 21 14:48:33 2013 +0200
@@ -81,6 +81,7 @@
brain->debug = (flags & DSYNC_BRAIN_FLAG_DEBUG) != 0;
brain->sync_visible_namespaces =
(flags & DSYNC_BRAIN_FLAG_SYNC_VISIBLE_NAMESPACES) != 0;
+ brain->no_mail_sync = (flags & DSYNC_BRAIN_FLAG_NO_MAIL_SYNC) != 0;
}
struct dsync_brain *
diff -r f722e60f9811 -r 38774adaddaf src/doveadm/dsync/dsync-brain.h
--- a/src/doveadm/dsync/dsync-brain.h Wed Mar 20 22:06:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain.h Thu Mar 21 14:48:33 2013 +0200
@@ -10,7 +10,10 @@
DSYNC_BRAIN_FLAG_BACKUP_SEND = 0x02,
DSYNC_BRAIN_FLAG_BACKUP_RECV = 0x04,
DSYNC_BRAIN_FLAG_DEBUG = 0x08,
- DSYNC_BRAIN_FLAG_SYNC_VISIBLE_NAMESPACES= 0x10
+ DSYNC_BRAIN_FLAG_SYNC_VISIBLE_NAMESPACES= 0x10,
+ /* Sync everything but the actual mails (e.g. mailbox creates,
+ deletes) */
+ DSYNC_BRAIN_FLAG_NO_MAIL_SYNC = 0x20
};
enum dsync_brain_sync_type {
More information about the dovecot-cvs
mailing list