Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v3] qsync: provide box.info interface for monitoring
Date: Thu, 8 Apr 2021 10:34:56 +0300	[thread overview]
Message-ID: <0661429d-3059-00ff-d2ea-89a06c99f117@tarantool.org> (raw)
In-Reply-To: <YGt0TACA8xe6N7Rr@grain>



05.04.2021 23:34, Cyrill Gorcunov пишет:
> Guys, here is an updated version. Take a look please.
> Vlad, lets stick with simple version and will add
> `queues` array if we ever really need to.
Hi! Thanks for the patch!

Please find one comment below.

>
> issue https://github.com/tarantool/tarantool/issues/5191
> branch gorcunov/gh-5191-qsync-stat-3
> ---
>
> diff --git a/src/box/lua/info.c b/src/box/lua/info.c
> index 8cd379756..a2ffff4b5 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 "sio.h"
> @@ -599,6 +600,29 @@ lbox_info_election(struct lua_State *L)
>   	return 1;
>   }
>   
> +static int
> +lbox_info_synchro(struct lua_State *L)
> +{
> +	lua_newtable(L);

Maybe change to lua_createtable(L, 0, 2) ?
This will be consistent with what is done below, and lua doc
states that'll be a bit faster:
https://www.lua.org/manual/5.3/manual.html#lua_newtable
(sorry, a direct link to lua_createtable didn't work)

> +
> +	/* Quorum value may be evaluated via formula */
> +	lua_pushinteger(L, replication_synchro_quorum);
> +	lua_setfield(L, -2, "quorum");
> +
> +	/*
> +	 * Queue information.
> +	 */
> +	struct txn_limbo *queue = &txn_limbo;
> +	lua_createtable(L, 0, 1);
> +	lua_pushstring(L, "len");
> +	lua_pushnumber(L, queue->len);
> +	lua_settable(L, -3);
> +	lua_setfield(L, -2, "queue");
> +
> +	return 1;
> +}
> +
> +
>   static const struct luaL_Reg lbox_info_dynamic_meta[] = {
>   	{"id", lbox_info_id},
>   	{"uuid", lbox_info_uuid},
> @@ -618,6 +642,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}
>   };
>
-- 
Serge Petrenko


  reply	other threads:[~2021-04-08  7:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 15:58 [Tarantool-patches] [PATCH v2] " Cyrill Gorcunov via Tarantool-patches
2021-04-05 20:34 ` [Tarantool-patches] [PATCH v3] " Cyrill Gorcunov via Tarantool-patches
2021-04-08  7:34   ` Serge Petrenko via Tarantool-patches [this message]
2021-04-08  7:40     ` Cyrill Gorcunov via Tarantool-patches
2021-04-07 20:53 ` [Tarantool-patches] [PATCH v2] " Vladislav Shpilevoy via Tarantool-patches
2021-04-07 21:15   ` Cyrill Gorcunov via Tarantool-patches
2021-04-07 22:52     ` Vladislav Shpilevoy via Tarantool-patches
2021-04-08  7:11       ` Cyrill Gorcunov via Tarantool-patches
2021-04-08 19:37         ` Vladislav Shpilevoy via Tarantool-patches
2021-04-08 19:54           ` Cyrill Gorcunov via Tarantool-patches
2021-04-08 19:57             ` Vladislav Shpilevoy via Tarantool-patches
2021-04-08 20:04               ` Cyrill Gorcunov via Tarantool-patches
2021-04-08 20:10                 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-08 20:19                   ` Cyrill Gorcunov 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=0661429d-3059-00ff-d2ea-89a06c99f117@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3] 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