<HTML><BODY>branch: gh-3160-disconnect-race-condition<br><br><br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
        Пятница, 16 февраля 2018, 14:44 +03:00 от Vladimir Davydov <vdavydov.dev@gmail.com>:<br><br><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_15187814750000000254_BODY">On Fri, Feb 16, 2018 at 02:39:11PM +0300, Konstantin Belyavskiy wrote:<br>
                                 > Incomming ACK lead to race condition and prevent heartbeat<br>
> messages. It ends up with disconnect on timeout.<br>
> This fix based on @locker proposal to send vclock only to<br>
> reply master (since it itself send heartbeat messages).<br>
> <br>
> Fix #3160<br>
> ---<br>
> branch: gh-3160-disconnect-race-condition<br>
>  src/box/applier.cc | 8 ++++++--<br><br>
Please add a test case.</div></div></div></div></blockquote>Done<br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_15187814750000000254_BODY"><br><br>
>  1 file changed, 6 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/src/box/applier.cc b/src/box/applier.cc<br>
> index 91769ae00..d9656c870 100644<br>
> --- a/src/box/applier.cc<br>
> +++ b/src/box/applier.cc<br>
> @@ -98,6 +98,11 @@ applier_log_error(struct applier *applier, struct error *e)<br>
>  <br>
>  /*<br>
>   * Fiber function to write vclock to replication master.<br>
> + * To track conncection status, replica answers to master<br>
> + * with encoded vclock. In addition to update requests,<br>
> + * master also sends heartbeat messages every<br>
> + * replication_timeout (introduced in 1.7.7).<br><br>
What happens if the master is older than 1.7.7 and so doesn't<br>
send heartbeats?</div></div></div></div></blockquote>Thank you, fixed<br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_15187814750000000254_BODY"><br><br>
> + * On such requests replica also responds with vlock.<br>
>   */<br>
>  static int<br>
>  applier_writer_f(va_list ap)<br>
> @@ -106,10 +111,9 @@ applier_writer_f(va_list ap)<br>
>    struct ev_io io;<br>
>    coio_create(&io, applier->io.fd);<br>
>  <br>
> -  /* Re-connect loop */<br>
>    while (!fiber_is_cancelled()) {<br>
>            fiber_cond_wait_timeout(&applier->writer_cond,<br>
> -                                  replication_timeout);<br>
> +                                  TIMEOUT_INFINITY);<br>
>            /* Send ACKs only when in FOLLOW mode ,*/<br>
>            if (applier->state != APPLIER_SYNC &&<br>
>                applier->state != APPLIER_FOLLOW)<br></div></div></div></div></blockquote>
<br>
<br>Best regards,<br>Konstantin Belyavskiy<br>k.belyavskiy@tarantool.org<br></BODY></HTML>