From: Oleg Babin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
tarantool-patches@dev.tarantool.org,
yaroslav.dynnikov@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH vshard 02/11] storage: add helper for local functions invocation
Date: Wed, 24 Feb 2021 13:27:24 +0300 [thread overview]
Message-ID: <6368c441-d22b-b20a-541e-1b5f7ac7622c@tarantool.org> (raw)
In-Reply-To: <5530ed726e56702c79f70567c6e22f29eec32a8b.1614039039.git.v.shpilevoy@tarantool.org>
Hi! Thanks for your patch. LGTM.
On 23.02.2021 03:15, Vladislav Shpilevoy wrote:
> Function local_call() works like netbox.self.call, but is
> exception-safe, and uses cached values of 'netbox.self' and
> 'netbox.self.call'. This saves at least 3 indexing operations,
> which are not free as it appeared.
>
> The cached values are not used directly in storage_call(), because
> local_call() also will be used from the future function
> storage_map() - a part of map-reduce API.
>
> Needed for #147
> ---
> vshard/storage/init.lua | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
> index e0ce31d..a3d383d 100644
> --- a/vshard/storage/init.lua
> +++ b/vshard/storage/init.lua
> @@ -6,6 +6,8 @@ local trigger = require('internal.trigger')
> local ffi = require('ffi')
> local yaml_encode = require('yaml').encode
> local fiber_clock = lfiber.clock
> +local netbox_self = netbox.self
> +local netbox_self_call = netbox_self.call
>
> local MODULE_INTERNALS = '__module_vshard_storage'
> -- Reload requirements, in case this module is reloaded manually.
> @@ -171,6 +173,16 @@ else
> bucket_ref_new = ffi.typeof("struct bucket_ref")
> end
>
> +--
> +-- Invoke a function on this instance. Arguments are unpacked into the function
> +-- as arguments.
> +-- The function returns pcall() as is, because is used from places where
> +-- exceptions are not allowed.
> +--
> +local function local_call(func_name, args)
> + return pcall(netbox_self_call, netbox_self, func_name, args)
> +end
> +
> --
> -- Trigger for on replace into _bucket to update its generation.
> --
> @@ -2275,7 +2287,7 @@ local function storage_call(bucket_id, mode, name, args)
> if not ok then
> return ok, err
> end
> - ok, ret1, ret2, ret3 = pcall(netbox.self.call, netbox.self, name, args)
> + ok, ret1, ret2, ret3 = local_call(name, args)
> _, err = bucket_unref(bucket_id, mode)
> assert(not err)
> if not ok then
next prev parent reply other threads:[~2021-02-24 10:27 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 0:15 [Tarantool-patches] [PATCH vshard 00/11] VShard Map-Reduce, part 2: Ref, Sched, Map Vladislav Shpilevoy via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 01/11] error: introduce vshard.error.timeout() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-24 21:46 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 12:42 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 10/11] sched: introduce vshard.storage.sched module Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:28 ` Oleg Babin via Tarantool-patches
2021-02-24 21:50 ` Vladislav Shpilevoy via Tarantool-patches
2021-03-04 21:02 ` Oleg Babin via Tarantool-patches
2021-03-05 22:06 ` Vladislav Shpilevoy via Tarantool-patches
2021-03-09 8:03 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 11/11] router: introduce map_callrw() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:28 ` Oleg Babin via Tarantool-patches
2021-02-24 22:04 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 12:43 ` Oleg Babin via Tarantool-patches
2021-02-26 23:58 ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 10:58 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 02/11] storage: add helper for local functions invocation Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches [this message]
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 03/11] storage: cache bucket count Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-24 21:47 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 12:42 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 04/11] registry: module for circular deps resolution Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 05/11] util: introduce safe fiber_cond_wait() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-24 21:48 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 12:42 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 06/11] util: introduce fiber_is_self_canceled() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 07/11] storage: introduce bucket_generation_wait() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 08/11] storage: introduce bucket_are_all_rw() Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:27 ` Oleg Babin via Tarantool-patches
2021-02-24 21:48 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-23 0:15 ` [Tarantool-patches] [PATCH vshard 09/11] ref: introduce vshard.storage.ref module Vladislav Shpilevoy via Tarantool-patches
2021-02-24 10:28 ` Oleg Babin via Tarantool-patches
2021-02-24 21:49 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 12:42 ` Oleg Babin via Tarantool-patches
2021-03-04 21:22 ` Oleg Babin via Tarantool-patches
2021-03-05 22:06 ` Vladislav Shpilevoy via Tarantool-patches
2021-03-09 8:03 ` Oleg Babin via Tarantool-patches
2021-03-21 18:49 ` Vladislav Shpilevoy via Tarantool-patches
2021-03-12 23:13 ` [Tarantool-patches] [PATCH vshard 00/11] VShard Map-Reduce, part 2: Ref, Sched, Map Vladislav Shpilevoy via Tarantool-patches
2021-03-15 7:05 ` Oleg Babin via Tarantool-patches
2021-03-28 18:17 ` 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=6368c441-d22b-b20a-541e-1b5f7ac7622c@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=olegrok@tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--cc=yaroslav.dynnikov@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH vshard 02/11] storage: add helper for local functions invocation' \
/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