<HTML><BODY><div>QA LGTM</div><div> </div><div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Vitaliia Ioffe</div></div></div><div> </div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Понедельник, 16 августа 2021, 18:15 +03:00 от Serge Petrenko <sergepetrenko@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16291269261820915594_BODY">upstream.lag is the delta between the moment when a row was written to<br>master's journal and the moment when it was received by the replica.<br>It's an important metric to check whether the replica has fallen too far<br>behind master.<br><br>Not all the rows coming from master have a valid time of creation. For<br>example, RAFT system messages don't have one, and we can't assign<br>correct time to them: these messages do not originate from the journal,<br>and assigning current time to them would lead to jumps in upstream.lag<br>results.<br><br>Stop updating upstream.lag for rows which don't have creation time<br>assigned.<br><br>The upstream.lag calculation changes were meant to fix the flaky<br>replication/errinj.test:<br><br> Test failed! Result content mismatch:<br> --- replication/errinj.result Fri Aug 13 15:15:35 2021<br> +++ /tmp/tnt/rejects/replication/errinj.reject Fri Aug 13 15:40:39 2021<br> @@ -310,7 +310,7 @@<br>  ...<br>  box.info.replication[1].upstream.lag < 1<br>  ---<br> -- true<br> +- false<br>  ...<br><br>But the changes were not enough, because now the test<br>may see the initial lag value (TIMEOUT_INFINITY).<br>So fix the test as well by waiting until upstream.lag becomes < 1.<br>---<br> src/box/applier.cc | 3 ++-<br> test/replication/errinj.result | 5 ++++-<br> test/replication/errinj.test.lua | 5 ++++-<br> 3 files changed, 10 insertions(+), 3 deletions(-)<br><br>diff --git a/src/box/applier.cc b/src/box/applier.cc<br>index 902d0bc72..9256078e1 100644<br>--- a/src/box/applier.cc<br>+++ b/src/box/applier.cc<br>@@ -664,7 +664,8 @@ applier_read_tx_row(struct applier *applier, double timeout)<br> <br>  coio_read_xrow_timeout_xc(coio, ibuf, row, timeout);<br> <br>- applier->lag = ev_now(loop()) - row->tm;<br>+ if (row->tm > 0)<br>+ applier->lag = ev_now(loop()) - row->tm;<br>  applier->last_row_time = ev_monotonic_now(loop());<br>  return tx_row;<br> }<br>diff --git a/test/replication/errinj.result b/test/replication/errinj.result<br>index 9d13f6aa7..ec251182f 100644<br>--- a/test/replication/errinj.result<br>+++ b/test/replication/errinj.result<br>@@ -308,7 +308,10 @@ box.info.replication[1].upstream.lag > 0<br> ---<br> - true<br> ...<br>-box.info.replication[1].upstream.lag < 1<br>+-- Upstream lag is huge until the first row is received.<br>+test_run:wait_cond(function()\<br>+ return box.info.replication[1].upstream.lag < 1\<br>+end)<br> ---<br> - true<br> ...<br>diff --git a/test/replication/errinj.test.lua b/test/replication/errinj.test.lua<br>index 19234ab35..7f6535ec1 100644<br>--- a/test/replication/errinj.test.lua<br>+++ b/test/replication/errinj.test.lua<br>@@ -130,7 +130,10 @@ test_run:cmd("switch replica")<br> while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end<br> box.info.replication[1].upstream.status<br> box.info.replication[1].upstream.lag > 0<br>-box.info.replication[1].upstream.lag < 1<br>+-- Upstream lag is huge until the first row is received.<br>+test_run:wait_cond(function()\<br>+ return box.info.replication[1].upstream.lag < 1\<br>+end)<br> -- wait for ack timeout<br> test_run:wait_upstream(1, {status='disconnected', message_re='unexpected EOF'})<br> <br>--<br>2.30.1 (Apple Git-130)</div></div></div></div></blockquote><div> </div></BODY></HTML>