[PATCH] applier: stop sending ACKs if master closed socket

Konstantin Osipov kostja at tarantool.org
Mon Jan 29 19:03:27 MSK 2018


* Vladimir Davydov <vdavydov.dev at gmail.com> [18/01/29 18:59]:
> 
>   main/107/applierw/ sio.cc:303 !> SystemError writev(2), called on fd 12, aka 127.0.0.1:50852: Broken pipe
> 
> To avoid that, let's make the applier writer fiber (the one that sends
> ACKs) exit immediately if it receives EPIPE error while trying to send
> an ACK.
> 
> Closes #2945
> ---
> Branch: gh-2945-applier-dont-send-acks-if-master-closed-socket
> 
>  src/box/applier.cc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/box/applier.cc b/src/box/applier.cc
> index f0073bad..e8907975 100644
> --- a/src/box/applier.cc
> +++ b/src/box/applier.cc
> @@ -118,6 +118,13 @@ applier_writer_f(va_list ap)
>  			coio_write_xrow(&io, &xrow);
>  		} catch (SocketError *e) {
>  			/*
> +			 * There is no point trying to send ACKs if
> +			 * the master closed its end - we would only
> +			 * spam the log - so exit immediately.
> +			 */
> +			if (e->get_errno() == EPIPE)
> +				break;
> +			/*

This fix it contradicts the comment below. 
If the applier ACK fiber got an error, it waits for reconnect. It
should not send "noisy" acks while this hasn't happened,
regardless of the type of error. Why is EPIPE special?

>  			 * Do not exit, if there is a network error,
>  			 * the reader fiber will reconnect for us
>  			 * and signal our cond afterwards.
> -- 
> 2.11.0

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list