]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: If I/O gets stalled, log the state in which it happened.
authorTimo Sirainen <tss@iki.fi>
Wed, 27 Feb 2013 10:34:00 +0000 (12:34 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 27 Feb 2013 10:34:00 +0000 (12:34 +0200)
src/doveadm/dsync/dsync-brain-mails.c
src/doveadm/dsync/dsync-brain-private.h
src/doveadm/dsync/dsync-brain.c
src/doveadm/dsync/dsync-ibc-private.h
src/doveadm/dsync/dsync-ibc-stream.c
src/doveadm/dsync/dsync-ibc.c
src/doveadm/dsync/dsync-ibc.h

index 87e5069e0d3f61c30d5118987619f0fa65b566ef..3988400d06bd0e70857318055010c8dab07acaf7 100644 (file)
@@ -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",
index bf2a127e0354331aadaa59c063f5bc66f46d4807..cafcc1dad42e93a899d7ba8e48f37a18145ba5df 100644 (file)
@@ -94,6 +94,8 @@ struct dsync_brain {
        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);
index cfca56c5b2df50dce5cab31991141a49ef822140..c702f276274c27b7eb5d9c9e65c58ecf23503df8 100644 (file)
@@ -160,6 +160,14 @@ int dsync_brain_deinit(struct dsync_brain **_brain)
 
        *_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;
index 0871f06d048a79bf297b28fc817cc529c8fcb0bc..4e155f4cea92e660c5b60572b1ced6c3f444e553 100644 (file)
@@ -73,6 +73,7 @@ struct dsync_ibc {
        void *io_context;
 
        unsigned int failed:1;
+       unsigned int timeout:1;
 };
 
 #endif
index bb89e8ce034eb888ee07fb72eceef6ca1131be58..19d2d1132e0d8a5ec48bde5ac8ec311b5a1af1a3 100644 (file)
@@ -273,6 +273,7 @@ static void dsync_ibc_stream_timeout(struct dsync_ibc_stream *ibc)
 {
        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);
 }
 
index a958923805bc5994dd6d0c2c579a0ec237e37120..704f25e48b1d0315a5ef523e2717b4777ef518cd 100644 (file)
@@ -188,6 +188,11 @@ bool dsync_ibc_has_failed(struct dsync_ibc *ibc)
        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);
index d3ac9037c28c7d8265c7629cb5a39e2b0ca6277d..ea3ba3011d9282f0e774bdf4f5041b3017f51095 100644 (file)
@@ -119,6 +119,7 @@ dsync_ibc_recv_mail(struct dsync_ibc *ibc, struct dsync_mail **mail_r);
 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);