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 2E63C6EC55; Thu, 17 Jun 2021 18:48:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2E63C6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623944923; bh=hBxYwcnWCAsq1utw5/MI+eNbDjquKBqvCrgk47w1NN8=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=cR+kYr+Xtt3/7Vxs7Y0Y7S5Y50Otz5wrviRs/soHGAUYQIRdeF/ZNVNweJp1/98g5 oGtYBNfkcl1dgwVtMRSR+netCAv84wEk51KYoUhOOpdBzmBRCq3e8dvkkrLZOlaKcY PPFSp4wXZWF/5RPptk0A4A7yKXd29pI3q9kYr3j8= Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 352176EC55 for ; Thu, 17 Jun 2021 18:48:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 352176EC55 Received: by mail-lf1-f46.google.com with SMTP id r5so11326758lfr.5 for ; Thu, 17 Jun 2021 08:48:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M/OgNRDpnDh0Pzhdsjxn35BJhreKrbx+ELHsIjvxQxU=; b=YjtrnwEEu1yd40XsTVxNH+RgpQOhEjhlIuP2vyh0iHLJLI0vhpHFa3mEMNfwov5F6y TZBppLbKhIDMt0+5CZMJLfUbjCJJYAsi3iG8BJtOeCMFFq1ECPMJZFvlOWW35BfrzjiW RSeQE5Zz08SSZV/0EazH4hkJK2ltaqqH8RHcGBp0SKAm8q9R1yClZaTwMNjw9ffwox5J q0e/1xS4Ic3P0NR3S1mPbn0rA6efUHx/HY/akLurkgOocF0F15Z7UafY9+iY/2MB+HGg zQxcq0KZIRrduClPrUtm2kJY0bRWQKY32cjJwFOc7tJA+nN8EQiC9kHnUjacsNqtiyiq Rb+Q== X-Gm-Message-State: AOAM5337iu1VryRTfh3IMHKAxjjWfZj+SV0u62Jdz9Ib+scySyDOL38t B7LjNdt4wWB5GQRBKBEz5jPTFAX5ESQ= X-Google-Smtp-Source: ABdhPJxxfxs1MYnREJFp7WpXafxNM3ifiSrpKWIcML/iEZ8+ratcb5xAaGpvj1J0kVcSlUd6Kej8kw== X-Received: by 2002:a05:6512:3d8f:: with SMTP id k15mr4691280lfv.362.1623944918910; Thu, 17 Jun 2021 08:48:38 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id b25sm618012lfo.271.2021.06.17.08.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 08:48:37 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 1C42D5A002A; Thu, 17 Jun 2021 18:48:37 +0300 (MSK) To: tml Date: Thu, 17 Jun 2021 18:48:33 +0300 Message-Id: <20210617154835.315576-1-gorcunov@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v9 0/2] relay: provide downstream lag information 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 Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Guys, take a look once time permit, hopefully manage to address all comments. Previous series at https://lists.tarantool.org/tarantool-patches/20210607155519.109626-1-gorcunov@gmail.com/ v4 (by Vlad): - add a test case - add docbot request - dropped off xrow_encode_vclock_timed, we use opencoded assignment for tm value when send ack - struct awstat renamed to applier_wal_stat. Vlad I think this is better name than "applier_lag" because this is statistics on WAL, we simply track remote WAL propagation here, so more general name is better for grep sake and for future extensions - instead of passing applier structure we pass replica_id - the real keeper of this statistics comes into "replica" structure thus unbound of applier itself - for synchro entries we pass a pointer to the applier_wal_stat instead of using replica_id = 0 as a sign that we don't need to update statistics for initial and final join cases - to write and read statistics we provide wal_stat_update and wal_stat_ack helpers to cover the case where single ACK spans several transactions v8: - make one branch less in apply_synchro_row() - keep applier_txn_start_tm inside replica stucture - rename wal_stat to replica_cb_data since this is more logical for case where we have no general stat engine - make applier to send timestamp so that relay will compute delta upon the read, the lag is kept permanently until new write happens - extend doc and changelog a bit - keep reading of relay's lag from TX thread without any modifications because relay get deleted from TX thread and set to non-RELAY_FOLLOW state, thus any attempt to read it won't success. To be honest there is a small race window present: write doubles are not atomic operation thus we might read partially updated timestamp similarly as we have with @idle field already. I think this should be addressed separately and better without heavy cmsg engine involved but with rw lock instead or plain atomics. v9 (Vlad and Serge): - update of transaction lag for reading by TX thread done via cbus message - use last timestamp from transaction to account - verify that we really need to test for replica being non-nil in applier reader - update docs - update a testcase branch gorcunov/gh-5447-relay-lag-9 issue https://github.com/tarantool/tarantool/issues/5447 Cyrill Gorcunov (2): applier: send transaction's first row WAL time in the applier_writer_f relay: provide information about downstream lag .../unreleased/gh-5447-downstream-lag.md | 6 + src/box/applier.cc | 97 +++++++++++-- src/box/lua/info.c | 3 + src/box/relay.cc | 94 ++++++++++++- src/box/relay.h | 6 + src/box/replication.cc | 1 + src/box/replication.h | 5 + .../replication/gh-5447-downstream-lag.result | 128 ++++++++++++++++++ .../gh-5447-downstream-lag.test.lua | 57 ++++++++ 9 files changed, 378 insertions(+), 19 deletions(-) create mode 100644 changelogs/unreleased/gh-5447-downstream-lag.md create mode 100644 test/replication/gh-5447-downstream-lag.result create mode 100644 test/replication/gh-5447-downstream-lag.test.lua base-commit: b5f0dc4db9aef9618f56b0bcb4a7b82a59591784 -- 2.31.1