From: "Илья Конюхов" <runsfor@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/2] feedback: collect db engines and index features
Date: Thu, 18 Jun 2020 18:42:58 +0300 [thread overview]
Message-ID: <8DEA1673-33E4-4930-9C61-45DEC371FE73@gmail.com> (raw)
In-Reply-To: <e1376d40-2d36-119d-d237-d53e64b28d23@tarantool.org>
Hi,
I’ve refactored code a bit according to your comment. See below.
> On 18 Jun 2020, at 01:53, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
>
> Hi! Thanks for the fixes!
>
>> I’ve worked on your comments and fixed lapses. See comments below.
>>
>> Besides that, are you ok with pushing this (Lua) patch forward?
>
> I am ok.
>
>>>> +local function fill_in_features_impl(features)
>>>> + fill_in_space_stats(features)
>>>> +end
>>>> +
>>>> +local cached_schema_version = 0
>>>> +local cached_feedback_features = {}
>>>
>>> 4. I would better move the cache handling into fill_in_space_stats().
>>> Because when you will add more features, not related to the schema,
>>> they won't relate to schema version.
>>>
>>> fill_in_features() should not use any caches. Does not depend on schema.
>>> fill_in_space_stats() can use the cache. Because fetches info from the
>>> schema.
>>>
>>> I mean, it works now, but we would need to rewrite that mostly, when
>>> more features will be collected.
>>
>> Agree. Extracted out caching into fill_in_space_stats(), but kept it in fill_in_features(), since space_stats is semantically features.
>
> This is a little bit better but basically is still the same. Just add
> a few dummy functions like
>
> fill_in_swim()
> fill_in_box_update()
> fill_in_vinyl_stat()
> fill_in_netbox()
>
> which would need to add several new fields to the feedback.features table,
> and see how hard it is to fit it into this code without rewriting it
> completely. Ideally addition of such new functions should not change a
> single line of the existing code.
>
> Perhaps you may need to store schema features in feedback.features.schema,
> not in feedback.features. So the schema becomes isolated from the other
> features. And store the others like feedback.features.swim,
> feedback.features.box_update, feedback.features.vinyl, etc. Not in a huge
> flat table.
I’ve thought about it in the first run, but decided to stick to the flat approach. Now within a context of us adding more features into a report it seems more reasonable to me. Fixed that and put schema statistics into feedback.features.schema field.
diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 111a70fca..ee58575a4 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -106,7 +106,7 @@ local function fill_in_indices_stats(space, stats)
end
end
-local function fill_in_space_stats_impl(features)
+local function fill_in_schema_stats_impl(schema)
local spaces = {
memtx = 0,
vinyl = 0,
@@ -143,30 +143,31 @@ local function fill_in_space_stats_impl(features)
end
for k, v in pairs(spaces) do
- features[k..'_spaces'] = v
+ schema[k..'_spaces'] = v
end
for k, v in pairs(indices) do
- features[k..'_indices'] = v
+ schema[k..'_indices'] = v
end
end
local cached_schema_version = 0
-local cached_feedback_features = {}
+local cached_schema_features = {}
-local function fill_in_space_stats(feedback)
+local function fill_in_schema_stats(features)
local schema_version = box.internal.schema_version()
if cached_schema_version < schema_version then
- local features = {}
- fill_in_space_stats_impl(features)
+ local schema = {}
+ fill_in_schema_stats_impl(schema)
cached_schema_version = schema_version
- cached_feedback_features = features
+ cached_schema_features = schema
end
- feedback.features = cached_feedback_features
+ features.schema = cached_schema_features
end
local function fill_in_features(feedback)
- fill_in_space_stats(feedback)
+ feedback.features = {}
+ fill_in_schema_stats(feedback.features)
end
local function fill_in_feedback(feedback)
next prev parent reply other threads:[~2020-06-18 15:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 8:35 [Tarantool-patches] [PATCH 0/2] Extend feedback module report Ilya Konyukhov
2020-06-05 8:35 ` [Tarantool-patches] [PATCH 1/2] feedback: determine runtime platform info Ilya Konyukhov
2020-06-07 16:45 ` Vladislav Shpilevoy
2020-06-09 23:05 ` Илья Конюхов
2020-06-11 19:32 ` Vladislav Shpilevoy
2020-07-01 0:16 ` Alexander Turenko
2020-07-05 2:14 ` Alexander Turenko
2020-06-05 8:35 ` [Tarantool-patches] [PATCH 2/2] feedback: collect db engines and index features Ilya Konyukhov
2020-06-07 16:45 ` Vladislav Shpilevoy
2020-06-09 23:06 ` Илья Конюхов
2020-06-11 19:32 ` Vladislav Shpilevoy
2020-06-17 8:59 ` Илья Конюхов
2020-06-17 22:53 ` Vladislav Shpilevoy
2020-06-18 15:42 ` Илья Конюхов [this message]
2020-06-18 23:02 ` Vladislav Shpilevoy
2020-06-19 14:01 ` Илья Конюхов
2020-06-19 23:49 ` Vladislav Shpilevoy
2020-06-22 8:55 ` Илья Конюхов
2020-07-01 0:15 ` Alexander Turenko
2020-07-03 12:05 ` Илья Конюхов
2020-07-05 2:10 ` Alexander Turenko
2020-06-23 21:23 ` [Tarantool-patches] [PATCH 0/2] Extend feedback module report Vladislav Shpilevoy
2020-07-13 13:47 ` Kirill Yukhin
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=8DEA1673-33E4-4930-9C61-45DEC371FE73@gmail.com \
--to=runsfor@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 2/2] feedback: collect db engines and index features' \
/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