From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tml <tarantool-patches@dev.tarantool.org> Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [Tarantool-patches] [RFC] qsync: provide box.info interface for monitoring Date: Fri, 12 Feb 2021 11:03:24 +0300 [thread overview] Message-ID: <20210212080324.274627-1-gorcunov@gmail.com> (raw) 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 <gorcunov@gmail.com> --- 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
next reply other threads:[~2021-02-12 8:03 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-12 8:03 Cyrill Gorcunov via Tarantool-patches [this message] 2021-02-17 21:01 ` Vladislav Shpilevoy via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210212080324.274627-1-gorcunov@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.perepelitsa@corp.mail.ru \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [RFC] qsync: provide box.info interface for monitoring' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox