dovecot-2.2: dsync: If I/O gets stalled, log the state in which ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Feb 27 12:34:29 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/f6377e089dee
changeset: 15986:f6377e089dee
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Feb 27 12:34:00 2013 +0200
description:
dsync: If I/O gets stalled, log the state in which it happened.

diffstat:

 src/doveadm/dsync/dsync-brain-mails.c   |  2 +-
 src/doveadm/dsync/dsync-brain-private.h |  2 ++
 src/doveadm/dsync/dsync-brain.c         |  8 ++++++++
 src/doveadm/dsync/dsync-ibc-private.h   |  1 +
 src/doveadm/dsync/dsync-ibc-stream.c    |  1 +
 src/doveadm/dsync/dsync-ibc.c           |  5 +++++
 src/doveadm/dsync/dsync-ibc.h           |  1 +
 7 files changed, 19 insertions(+), 1 deletions(-)

diffs (90 lines):

diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-brain-mails.c
--- a/src/doveadm/dsync/dsync-brain-mails.c	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-mails.c	Wed Feb 27 12:34:00 2013 +0200
@@ -8,7 +8,7 @@
 #include "dsync-mailbox-export.h"
 #include "dsync-brain-private.h"
 
-static const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = {
+const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = {
 	"mailbox",
 	"changes",
 	"mail_requests",
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-brain-private.h
--- a/src/doveadm/dsync/dsync-brain-private.h	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-private.h	Wed Feb 27 12:34:00 2013 +0200
@@ -94,6 +94,8 @@
 	unsigned int failed:1;
 };
 
+extern const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1];
+
 void dsync_brain_mailbox_trees_init(struct dsync_brain *brain);
 void dsync_brain_send_mailbox_tree(struct dsync_brain *brain);
 void dsync_brain_send_mailbox_tree_deletes(struct dsync_brain *brain);
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-brain.c
--- a/src/doveadm/dsync/dsync-brain.c	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain.c	Wed Feb 27 12:34:00 2013 +0200
@@ -160,6 +160,14 @@
 
 	*_brain = NULL;
 
+	if (dsync_ibc_has_timed_out(brain->ibc)) {
+		i_error("Timeout during state=%s%s",
+			dsync_state_names[brain->state],
+			brain->state != DSYNC_STATE_SYNC_MAILS ? "" :
+			t_strdup_printf(" (send=%s recv=%s)",
+				dsync_box_state_names[brain->box_send_state],
+				dsync_box_state_names[brain->box_recv_state]));
+	}
 	if (dsync_ibc_has_failed(brain->ibc) ||
 	    brain->state != DSYNC_STATE_DONE)
 		brain->failed = TRUE;
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-ibc-private.h
--- a/src/doveadm/dsync/dsync-ibc-private.h	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-ibc-private.h	Wed Feb 27 12:34:00 2013 +0200
@@ -73,6 +73,7 @@
 	void *io_context;
 
 	unsigned int failed:1;
+	unsigned int timeout:1;
 };
 
 #endif
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-ibc-stream.c
--- a/src/doveadm/dsync/dsync-ibc-stream.c	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-ibc-stream.c	Wed Feb 27 12:34:00 2013 +0200
@@ -273,6 +273,7 @@
 {
 	i_error("dsync(%s): I/O has stalled, no activity for %u seconds",
 		ibc->name, DSYNC_IBC_STREAM_TIMEOUT_MSECS/1000);
+	ibc->ibc.timeout = TRUE;
 	dsync_ibc_stream_stop(ibc);
 }
 
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-ibc.c
--- a/src/doveadm/dsync/dsync-ibc.c	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-ibc.c	Wed Feb 27 12:34:00 2013 +0200
@@ -188,6 +188,11 @@
 	return ibc->failed;
 }
 
+bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc)
+{
+	return ibc->timeout;
+}
+
 bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc)
 {
 	return ibc->v.is_send_queue_full(ibc);
diff -r 82ce71d8625c -r f6377e089dee src/doveadm/dsync/dsync-ibc.h
--- a/src/doveadm/dsync/dsync-ibc.h	Wed Feb 27 12:07:06 2013 +0200
+++ b/src/doveadm/dsync/dsync-ibc.h	Wed Feb 27 12:34:00 2013 +0200
@@ -119,6 +119,7 @@
 void dsync_ibc_close_mail_streams(struct dsync_ibc *ibc);
 
 bool dsync_ibc_has_failed(struct dsync_ibc *ibc);
+bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc);
 bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc);
 bool dsync_ibc_has_pending_data(struct dsync_ibc *ibc);
 


More information about the dovecot-cvs mailing list