From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>,
alexander.turenko@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 4/4] feedback_daemon: generate report right before sending
Date: Mon, 5 Apr 2021 18:23:09 +0200 [thread overview]
Message-ID: <36dca5a2-9e18-e517-78d2-827b85cbc3e1@tarantool.org> (raw)
In-Reply-To: <6216debc-5807-ede1-df21-823d60a1e70b@tarantool.org>
Thanks for the patch!
The patch is mostly fine, but I don't see why would we need it, as well
as why do we need to know when a first space is created. I don't argue,
only making a note. Unless it would affect the perf or normal code base
complexity anyhow.
See 2 comments below.
> diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
> index 0aab189b6..ca93b7574 100644
> --- a/src/box/lua/feedback_daemon.lua
> +++ b/src/box/lua/feedback_daemon.lua
> @@ -358,12 +363,26 @@ local function guard_loop(self)
> self.shutdown:put("stopped")
> end
>
> +local function save_event(self, event)
> + if type(event) ~= 'string' then
> + error("Usage: box.internal.feedback_daemon.save_event(string)")
> + end
> + local cnt = self.cached_events[event] or 0
1. cnt is unused. Did it pass luacheck? I suppose you wanted something like
this:
====================
@@ -367,9 +367,9 @@ local function save_event(self, event)
if type(event) ~= 'string' then
error("Usage: box.internal.feedback_daemon.save_event(string)")
end
- local cnt = self.cached_events[event] or 0
- self.cached_events[event] = (self.cached_events[event] or 0) + 1
- if self.cached_events[event] == 1 then
+ local cnt = (self.cached_events[event] + 1) or 1
+ self.cached_events[event] = cnt
+ if cnt == 1 then
-- The first occurred event of this type triggers report dispatch
-- immediately.
self.send()
====================
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index 96503a50e..cf1b070af 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua
> @@ -462,6 +462,10 @@ box.schema.space.create = function(name, options)
> })
> _space:insert{id, uid, name, options.engine, options.field_count,
> space_options, format}
> +
> + if internal.feedback_daemon ~= nil then
> + internal.feedback_daemon.save_event("create_space")
2. To make it less ugly you could save feedback_daemon into a local
variable in this file, and access it as an upvalue in all the
usages. Or wrap the entire 'save_event' thing here into a function
which checks that the daemon is not nil, and then call its
save_event function.
next prev parent reply other threads:[~2021-04-05 16:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 14:57 [Tarantool-patches] [PATCH 0/4] send feedback on tarantool start Serge Petrenko via Tarantool-patches
2021-04-02 14:58 ` [Tarantool-patches] [PATCH 1/4] feedback_daemon: include server uptime in the report Serge Petrenko via Tarantool-patches
2021-04-02 14:58 ` [Tarantool-patches] [PATCH 2/4] feedback_daemon: rename `send_test` to `send` Serge Petrenko via Tarantool-patches
2021-04-02 14:58 ` [Tarantool-patches] [PATCH 3/4] feedback_daemon: send feedback on server start Serge Petrenko via Tarantool-patches
2021-04-05 13:18 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-05 14:05 ` Serge Petrenko via Tarantool-patches
2021-04-05 16:11 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-08 13:41 ` Serge Petrenko via Tarantool-patches
2021-04-02 14:58 ` [Tarantool-patches] [PATCH 4/4] feedback_daemon: generate report right before sending Serge Petrenko via Tarantool-patches
2021-04-05 14:03 ` Serge Petrenko via Tarantool-patches
2021-04-05 16:23 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-04-06 8:18 ` Serge Petrenko 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=36dca5a2-9e18-e517-78d2-827b85cbc3e1@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 4/4] feedback_daemon: generate report right before sending' \
/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