dovecot-2.2: dsync: -U parameter never updated replicator's full...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 8 15:33:47 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/1a58d4bcb49c
changeset: 16253:1a58d4bcb49c
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 08 15:33:23 2013 +0300
description:
dsync: -U parameter never updated replicator's full_sync state.

diffstat:

 src/doveadm/dsync/doveadm-dsync.c |  10 +++++++---
 src/doveadm/dsync/dsync-brain.c   |   5 +++++
 src/doveadm/dsync/dsync-brain.h   |   2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)

diffs (74 lines):

diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c	Mon Apr 08 15:13:39 2013 +0300
+++ b/src/doveadm/dsync/doveadm-dsync.c	Mon Apr 08 15:33:23 2013 +0300
@@ -443,7 +443,9 @@
 }
 
 static void
-dsync_replicator_notify(struct dsync_cmd_context *ctx, const char *state_str)
+dsync_replicator_notify(struct dsync_cmd_context *ctx,
+			enum dsync_brain_sync_type sync_type,
+			const char *state_str)
 {
 #define REPLICATOR_HANDSHAKE "VERSION\treplicator-doveadm-client\t1\t0\n"
 	const char *path;
@@ -465,7 +467,7 @@
 	str_append(str, REPLICATOR_HANDSHAKE"NOTIFY\t");
 	str_append_tabescaped(str, ctx->ctx.cur_mail_user->username);
 	str_append_c(str, '\t');
-	if (ctx->sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL)
+	if (sync_type == DSYNC_BRAIN_SYNC_TYPE_FULL)
 		str_append_c(str, 'f');
 	str_append_c(str, '\t');
 	str_append_tabescaped(str, state_str);
@@ -910,6 +912,7 @@
 	struct dsync_ibc *ibc;
 	struct dsync_brain *brain;
 	string_t *temp_prefix, *state_str = NULL;
+	enum dsync_brain_sync_type sync_type;
 
 	if (_ctx->conn != NULL) {
 		/* doveadm-server connection. start with a success reply.
@@ -937,6 +940,7 @@
 		state_str = t_str_new(128);
 		dsync_brain_get_state(brain, state_str);
 	}
+	sync_type = dsync_brain_get_sync_type(brain);
 
 	if (dsync_brain_deinit(&brain) < 0)
 		_ctx->exit_code = EX_TEMPFAIL;
@@ -949,7 +953,7 @@
 	}
 
 	if (ctx->replicator_notify)
-		dsync_replicator_notify(ctx, str_c(state_str));
+		dsync_replicator_notify(ctx, sync_type, str_c(state_str));
 	return _ctx->exit_code == 0 ? 0 : -1;
 }
 
diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/dsync-brain.c
--- a/src/doveadm/dsync/dsync-brain.c	Mon Apr 08 15:13:39 2013 +0300
+++ b/src/doveadm/dsync/dsync-brain.c	Mon Apr 08 15:33:23 2013 +0300
@@ -498,6 +498,11 @@
 	dsync_mailbox_states_export(brain->mailbox_states, output);
 }
 
+enum dsync_brain_sync_type dsync_brain_get_sync_type(struct dsync_brain *brain)
+{
+	return brain->sync_type;
+}
+
 bool dsync_brain_has_failed(struct dsync_brain *brain)
 {
 	return brain->failed;
diff -r 54cdc5b6727c -r 1a58d4bcb49c src/doveadm/dsync/dsync-brain.h
--- a/src/doveadm/dsync/dsync-brain.h	Mon Apr 08 15:13:39 2013 +0300
+++ b/src/doveadm/dsync/dsync-brain.h	Mon Apr 08 15:33:23 2013 +0300
@@ -50,5 +50,7 @@
 /* Returns the current sync state string, which can be given as parameter to
    dsync_brain_master_init() to quickly sync only the new changes. */
 void dsync_brain_get_state(struct dsync_brain *brain, string_t *output);
+/* Returns the sync type that was used. Mainly useful with slave brain. */
+enum dsync_brain_sync_type dsync_brain_get_sync_type(struct dsync_brain *brain);
 
 #endif


More information about the dovecot-cvs mailing list