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 283E0645E7; Fri, 12 Feb 2021 11:03:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 283E0645E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613117009; bh=SdVZN9kMuzn7+x2dghndeVSRc+BcNm2ziruVejq4eM4=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=D1QoxFozjGgJW4Ybs2l8cfe0dwpYRbqAc+odx3ixtS7GmwApJBz24R+9qvRDu2azV M7aj4AO1w+E+ZIc6mgkvpAntG9nWAat9oeTnmUg9zE1eHO/re+GzzGliLknBXPGVl+ uKpvokOVlpoF3/pkRo73rAodLgerm327AbxtY4r4= Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 F1657686FF for ; Fri, 12 Feb 2021 11:03:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F1657686FF Received: by mail-lj1-f182.google.com with SMTP id r23so10581951ljh.1 for ; Fri, 12 Feb 2021 00:03:27 -0800 (PST) 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=7HtasH0yYnW+OaFSFuzYAGL5ZVAqQd65CCtEN+SLzy8=; b=dUkFC3Rs05G0+nAC5FzNpV3YPr7tBbiN5Yoo9NMvHgVqqeJUwhiM9ge0TUtIL6Tiwm RrgKOncDKz0i+97Bg4LD5wb49duTsBJvcTQ3NMJRtDdjC2DT/Nl0m9WPFPuN5Umm2yOo wrytulUG3CuKr0iTuLqpaGY238OiJ6XOuqIn5y5AcZbvaGA9A2XzazWMEr3moSyFFRlf +QdUb30OUPe25Be56jdzFmcTQsrFoaDfshoIlqslAmdjn5GJWvCp6Q3UHF8Y342f648+ G5o+++wScuU/KAXkDaKvabC6WIzW0CS5mvMZWRJ7QKdznHjKhsyh7h/D3v48qMkA1Zd6 vGiQ== X-Gm-Message-State: AOAM530lO3E75vcOwft8mGBlDYkDPg54qxzCjM8eR2ZgKI6m9aEm8R1d 1bOHeNwUO0l2E/3T/eP0O9k= X-Google-Smtp-Source: ABdhPJwJnHd0rHMVqUaljzv/fzEPW8/Imn8gdtTw/0vmKhH4ZdAcHXrv0YclH9AM8AYhWEkZkunmSw== X-Received: by 2002:a2e:a550:: with SMTP id e16mr1078426ljn.197.1613117007361; Fri, 12 Feb 2021 00:03:27 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id w17sm912528lfu.280.2021.02.12.00.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 00:03:25 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 617B7560083; Fri, 12 Feb 2021 11:03:25 +0300 (MSK) To: tml Date: Fri, 12 Feb 2021 11:03:24 +0300 Message-Id: <20210212080324.274627-1-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [RFC] qsync: provide box.info interface for monitoring 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: Mons Anderson , Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Since commit 14fa5fd82 we support symbolic evaluation of replication_synchro_quorum parameter and there is no easy way to obtain it current run-time value, ie evaluated one. Moreover we would like to fetch queue length on transaction limbo for tests and extend this tatistics in future. Thus we introduce "synchro" leaf in box.info interface. For now only a few entries are printed out | synchro: | limbo: | qlen: 0 | owner_id: 0 | quorum: 1 Where `qlen` stands for current limbo number of entries in queue, `owner_id` for limbo owner, and finally `quorum` for evaluated `replication_synchro_quorum` parameter. Part-of #4642 Signed-off-by: Cyrill Gorcunov --- issue https://github.com/tarantool/tarantool/issues/5191 Guys, I didn't put is anywhere yet, because I would like to gather comments on design, so not for merge. 1) Vlad pointed that we might have several limbo instances in future. Should I start printing limbos as map initially, say synchro: limbo: 1: qlen: 0 owner_id: 0 2: qlen: 0 owner_id: 0 where 1 and 2 gonna be either plain enumeration of limbo instances? 2) Vlad, could you please comment which else values we need for better testing? 3) Mons, could you please think through what else parameters are might be needed for solutions team? 4) Any other ideas are highly appreciated! src/box/lua/info.c | 29 +++++++++++++++++++++++++++++ src/box/txn_limbo.c | 5 ++++- src/box/txn_limbo.h | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/box/lua/info.c b/src/box/lua/info.c index c4c9fa0a0..f15d733b5 100644 --- a/src/box/lua/info.c +++ b/src/box/lua/info.c @@ -50,6 +50,7 @@ #include "version.h" #include "box/box.h" #include "box/raft.h" +#include "box/txn_limbo.h" #include "lua/utils.h" #include "fiber.h" #include "tt_static.h" @@ -594,6 +595,33 @@ lbox_info_election(struct lua_State *L) return 1; } +static int +lbox_info_synchro(struct lua_State *L) +{ + struct txn_limbo *limbo = &txn_limbo; + (void)limbo; + + /* box.info.synchro */ + lua_newtable(L); + + /* Quorum value may be evaluated via formula */ + lua_pushinteger(L, replication_synchro_quorum); + lua_setfield(L, -2, "quorum"); + + /* Transation queue related data. */ + lua_newtable(L); + lua_pushstring(L, "owner_id"); + lua_pushnumber(L, limbo->owner_id); + lua_settable(L, -3); + lua_pushstring(L, "qlen"); + lua_pushnumber(L, limbo->qlen); + lua_settable(L, -3); + + lua_setfield(L, -2, "limbo"); + return 1; +} + + static const struct luaL_Reg lbox_info_dynamic_meta[] = { {"id", lbox_info_id}, {"uuid", lbox_info_uuid}, @@ -613,6 +641,7 @@ static const struct luaL_Reg lbox_info_dynamic_meta[] = { {"sql", lbox_info_sql}, {"listen", lbox_info_listen}, {"election", lbox_info_election}, + {"synchro", lbox_info_synchro}, {NULL, NULL} }; diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index 9c4c3cdf1..8abe9310d 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -41,6 +41,7 @@ static inline void txn_limbo_create(struct txn_limbo *limbo) { rlist_create(&limbo->queue); + limbo->qlen = 0; limbo->owner_id = REPLICA_ID_NIL; fiber_cond_create(&limbo->wait_cond); vclock_create(&limbo->vclock); @@ -118,6 +119,7 @@ txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn) e->is_commit = false; e->is_rollback = false; rlist_add_tail_entry(&limbo->queue, e, in_queue); + limbo->qlen++; /* * We added new entries from a remote instance to an empty limbo. * Time to make this instance read-only. @@ -132,8 +134,8 @@ txn_limbo_remove(struct txn_limbo *limbo, struct txn_limbo_entry *entry) { assert(!rlist_empty(&entry->in_queue)); assert(txn_limbo_first_entry(limbo) == entry); - (void) limbo; rlist_del_entry(entry, in_queue); + limbo->qlen--; } static inline void @@ -144,6 +146,7 @@ txn_limbo_pop(struct txn_limbo *limbo, struct txn_limbo_entry *entry) assert(entry->is_rollback); rlist_del_entry(entry, in_queue); + limbo->qlen--; ++limbo->rollback_count; } diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h index c28b5666d..43505e7a2 100644 --- a/src/box/txn_limbo.h +++ b/src/box/txn_limbo.h @@ -94,6 +94,10 @@ struct txn_limbo { * them LSNs in the same order. */ struct rlist queue; + /** + * Number of entries in limbo queue. + */ + int64_t qlen; /** * Instance ID of the owner of all the transactions in the * queue. Strictly speaking, nothing prevents to store not -- 2.29.2