dovecot-2.2: replicator: Use locking when running dsync.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jan 31 21:49:12 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/138f1c76c0ec
changeset: 15704:138f1c76c0ec
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jan 31 21:49:00 2013 +0200
description:
replicator: Use locking when running dsync.

diffstat:

 src/replication/replicator/doveadm-connection.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 1bd70d505ef7 -r 138f1c76c0ec src/replication/replicator/doveadm-connection.c
--- a/src/replication/replicator/doveadm-connection.c	Thu Jan 31 21:01:09 2013 +0200
+++ b/src/replication/replicator/doveadm-connection.c	Thu Jan 31 21:49:00 2013 +0200
@@ -14,6 +14,11 @@
 #define DOVEADM_FAIL_TIMEOUT_MSECS (1000*5)
 #define DOVEADM_HANDSHAKE "VERSION\tdoveadm-server\t1\t0\n"
 
+/* normally there shouldn't be any need for locking, since replicator doesn't
+   start dsync in parallel for the same user. we'll do locking just in case
+   anyway */
+#define DSYNC_LOCK_TIMEOUT_SECS 30
+
 struct doveadm_connection {
 	char *path;
 	int fd;
@@ -195,7 +200,7 @@
 		cmd = t_str_new(256);
 		str_append_c(cmd, '\t');
 		str_append_tabescaped(cmd, username);
-		str_append(cmd, "\tsync\t-d");
+		str_printfa(cmd, "\tsync\t-d\t-l\t%u", DSYNC_LOCK_TIMEOUT_SECS);
 		if (full)
 			str_append(cmd, "\t-f");
 		str_append(cmd, "\t-s\t");


More information about the dovecot-cvs mailing list