From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 63BDE6EC58; Mon, 21 Jun 2021 19:17:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 63BDE6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624292246; bh=Y9BlrYRTSoGIhSOhN5CWCD2QHy06nI7EpeuYRAfqpbE=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nCmmJZFA9Rd3CydzrGAj/KLp44yN6pWrbh0JmNHxz9wiR3+or59h+GPj0N//4Bcgl qELi3UFkOxC7u8EYV4S7RZUf5SBns1LHYBGgyt5dOJb5+h7LvqY67OTntuBS3Vlari rXoKLh362wkT3gKD6cZuQ4Oiim9PEArP8SXmqbYQ= Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B9C796EC58 for ; Mon, 21 Jun 2021 19:17:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B9C796EC58 Received: by mail-lf1-f41.google.com with SMTP id i1so4132512lfe.6 for ; Mon, 21 Jun 2021 09:17:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aTGckhiH70b2r8zuKr99318CT+eKtdqySqFY3WMVY5k=; b=g1E040JHJDzy4LMqx7oFWGSveQr/iDJa04OJeZJg48lph/q2QQ6SCOu2Aamfit9iWl /Rq4Lmr5wIsE95rwN1Rg3pIDFJtSJYWAhKhhV8xqmtcxwdaqxpRNr5JmP+o2S8yyCywP SXJuRCNXjkPJ1fE1W9o0RdUWgJ1aFKLMFs+MuDMu0bnHQo862dIMzP2VvWjw04hgQpgA /8bdkuzhoEpQbzLA+jNSixVAqvii5phO3G+oYiVquQBw/z8nXm+L0qKkTSYcHHL0Se2y TD7+p30d+dz/9mBiEOV3TYWPl/Z/lblEgBp91W2UBhFwwPhVXxue0mMn/HE11zndFGeG Y7cg== X-Gm-Message-State: AOAM5300anQUMjvZ9D04Y/KLULaMDrPpex9DNvWsLYBD97lGnO4wr0pe sYIkdvTqglmgV7K3ZDxQTVgE3u4/LSA= X-Google-Smtp-Source: ABdhPJyXlqyWeViF6PZyXmo33fvyNGSzvBy/u7Hw5DKiZZZ60AvA7qeSB5bPoTj4mOgaBtD2Z3wiIA== X-Received: by 2002:a05:6512:2206:: with SMTP id h6mr15722296lfu.345.1624292242466; Mon, 21 Jun 2021 09:17:22 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id b5sm1272691lfv.3.2021.06.21.09.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 09:17:21 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 8EB4D5A0020; Mon, 21 Jun 2021 19:17:20 +0300 (MSK) Date: Mon, 21 Jun 2021 19:17:20 +0300 To: Vladislav Shpilevoy Cc: tml Message-ID: References: <20210617154835.315576-1-gorcunov@gmail.com> <20210617154835.315576-3-gorcunov@gmail.com> <909ea97e-9b56-d327-860b-65aba685fce3@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <909ea97e-9b56-d327-860b-65aba685fce3@tarantool.org> User-Agent: Mutt/2.0.7 (2021-05-04) Subject: Re: [Tarantool-patches] [PATCH v9 2/2] relay: provide information about downstream lag X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Sun, Jun 20, 2021 at 04:37:21PM +0200, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch! > > The test fails when I run it multiple times: > > [014] Test failed! Result content mismatch: > [014] --- replication/gh-5447-downstream-lag.result Sun Jun 20 16:10:26 2021 > [014] +++ var/rejects/replication/gh-5447-downstream-lag.reject Sun Jun 20 16:33:01 2021 > [014] @@ -37,7 +37,7 @@ > [014] -- Upon replica startup there is no ACKs to process. > [014] assert(box.info.replication[replica_id].downstream.lag == 0) > [014] | --- > [014] - | - true > [014] + | - error: assertion failed! > > See 4 comments below. Vlad, here is an update, I force pushed it into the same branch. I'll fix the error injection nit. Could you please retry the test to run simultaneously (I did it locally with 200 tests but it didn't trigger anything). I rebased the series on top of master. --- >From da969da89beab720c91c7e895613ab9cf6ab2ea7 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 21 Jun 2021 14:30:52 +0300 Subject: [PATCH] Update Signed-off-by: Cyrill Gorcunov --- src/box/relay.cc | 19 +------------------ .../replication/gh-5447-downstream-lag.result | 10 +++------- .../gh-5447-downstream-lag.test.lua | 3 +-- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/box/relay.cc b/src/box/relay.cc index 14c9b0f03..115037fc3 100644 --- a/src/box/relay.cc +++ b/src/box/relay.cc @@ -160,11 +160,6 @@ struct relay { struct stailq pending_gc; /** Time when last row was sent to peer. */ double last_row_time; - /** - * Last timestamp observed from remote node to - * compute @a txn_lag value. - */ - double txn_acked_tm; /** * A time difference between the moment when we * wrote a transaction to the local WAL and when @@ -310,15 +305,6 @@ relay_start(struct relay *relay, int fd, uint64_t sync, relay->state = RELAY_FOLLOW; relay->row_count = 0; relay->last_row_time = ev_monotonic_now(loop()); - /* - * We assume that previously written rows in WAL - * are older than current node real time which allows - * to simplify @a tx.txn_lag calculation. In worst - * scenario when runtime has been adjusted backwards - * between restart we simply get some big value in - * @a tx.txn_lag until next transaction get replicated. - */ - relay->txn_acked_tm = ev_now(loop()); } void @@ -375,7 +361,6 @@ relay_stop(struct relay *relay) * If relay is stopped then lag statistics should * be updated on next new ACK packets obtained. */ - relay->txn_acked_tm = 0; relay->txn_lag = 0; relay->tx.txn_lag = 0; } @@ -682,10 +667,8 @@ relay_reader_f(va_list ap) * can compute time spent regardless of the clock * value on remote replica. */ - if (relay->txn_acked_tm < xrow.tm) { - relay->txn_acked_tm = xrow.tm; + if (xrow.tm != 0) relay->txn_lag = ev_now(loop()) - xrow.tm; - } fiber_cond_signal(&relay->reader_cond); } } catch (Exception *e) { diff --git a/test/replication/gh-5447-downstream-lag.result b/test/replication/gh-5447-downstream-lag.result index 2cc020451..0d5de2564 100644 --- a/test/replication/gh-5447-downstream-lag.result +++ b/test/replication/gh-5447-downstream-lag.result @@ -70,17 +70,10 @@ test_run:switch('default') | --- | - true | ... -lsn = box.info.lsn - | --- - | ... box.space.test:insert({1}) | --- | - [1] | ... -test_run:wait_cond(function() return box.info.lsn > lsn end) - | --- - | - true - | ... -- The record is written on the master node. test_run:switch('replica') | --- @@ -111,6 +104,9 @@ test_run:switch('default') | --- | - true | ... +box.space.test:drop() + | --- + | ... box.schema.user.revoke('guest', 'replication') | --- | ... diff --git a/test/replication/gh-5447-downstream-lag.test.lua b/test/replication/gh-5447-downstream-lag.test.lua index 3096e2ac3..dd1d2e2c9 100644 --- a/test/replication/gh-5447-downstream-lag.test.lua +++ b/test/replication/gh-5447-downstream-lag.test.lua @@ -35,9 +35,7 @@ box.error.injection.set("ERRINJ_WAL_DELAY", true) -- -- Insert a record and wakeup replica's WAL to process data. test_run:switch('default') -lsn = box.info.lsn box.space.test:insert({1}) -test_run:wait_cond(function() return box.info.lsn > lsn end) -- The record is written on the master node. test_run:switch('replica') box.error.injection.set("ERRINJ_WAL_DELAY", false) @@ -51,6 +49,7 @@ assert(box.info.replication[replica_id].downstream.lag > 0) -- -- Cleanup everything. test_run:switch('default') +box.space.test:drop() box.schema.user.revoke('guest', 'replication') test_run:cmd('stop server replica') test_run:cmd('cleanup server replica') -- 2.31.1