[PATCH] applier: stop sending ACKs if master closed socket
Konstantin Osipov
kostja at tarantool.org
Mon Jan 29 21:22:03 MSK 2018
* Vladimir Davydov <vdavydov.dev at gmail.com> [18/01/29 20:21]:
> > >
> > > 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?
>
> When it happens (EPIPE), the applier is still connected to the master,
> because there are rows left in the socket. For every row applied, the
> applier wakes up the writer (via writer_cond), which makes it send an
> ack and consequently log an error as the receiving end (at the master's
> side) has been closed.
Why are we reading and acking rows one by one in the first place?
We should be acking the entier batch with a single event, no?
> >
> > > * Do not exit, if there is a network error,
> > > * the reader fiber will reconnect for us
> > > * and signal our cond afterwards.
--
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