From b177faacd6e5e338be387af5675dfff8c656f715 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 24 Sep 2013 14:42:21 +0100 Subject: [PATCH] mirror: Reduce the mirror convergence window to 5 seonds, from 60 Also remove some obsolete constants --- src/mirror.c | 14 +------------- src/mirror.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mirror.c b/src/mirror.c index a572e5c..e49d658 100644 --- a/src/mirror.c +++ b/src/mirror.c @@ -213,18 +213,6 @@ void mirror_destroy( struct mirror *mirror ) /** The mirror code will split NBD writes, making them this long as a maximum */ static const int mirror_longest_write = 8<<20; -/** If, during a mirror pass, we have sent this number of bytes or fewer, we - * go to freeze the I/O and finish it off. This is just a guess. - */ -static const unsigned int mirror_last_pass_after_bytes_written = 100<<20; - -/** The largest number of full passes we'll do - the last one will always - * cause the I/O to freeze, however many bytes are left to copy. - */ -static const int mirror_maximum_passes = 7; -#define mirror_last_pass (mirror_maximum_passes - 1) - - /* This must not be called if there's any chance of further I/O. Methods to * ensure this include: * - Ensure image size is 0 @@ -603,7 +591,7 @@ static void mirror_read_cb( struct ev_loop *loop, ev_io *w, int revents ) /* Regardless of time estimates, if there's no waiting transfer, we can * */ - if ( !ctrl->clients_closed && ( !next_xfer || server_mirror_eta( ctrl->serve ) < 60 ) ) { + if ( !ctrl->clients_closed && ( !next_xfer || server_mirror_eta( ctrl->serve ) < MS_CONVERGE_TIME_SECS ) ) { info( "Closing clients to allow mirroring to converge" ); server_forbid_new_clients( ctrl->serve ); server_close_clients( ctrl->serve ); diff --git a/src/mirror.h b/src/mirror.h index cc43b22..21682a6 100644 --- a/src/mirror.h +++ b/src/mirror.h @@ -18,6 +18,18 @@ enum mirror_state; */ #define MS_CONNECT_TIME_SECS 60 +/* MS_MAX_DOWNTIME_SECS + * The length of time a migration must be estimated to have remaining for us to + * disconnect clients for convergence + * + * TODO: Make this configurable so refusing-to-converge clients can be manually + * fixed. + * TODO: Make this adaptive - 5 seconds is fine, as long as we can guarantee + * that all migrations will be able to converge in time. We'd add a new + * state between open and closed, where gradually-increasing latency is + * added to client requests to allow the mirror to be faster. + */ +#define MS_CONVERGE_TIME_SECS 5 /* MS_HELLO_TIME_SECS * The length of time the sender will wait for the NBD hello message