Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: korablev@tarantool.org, tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH v2 1/2] Add space names cache
Date: Wed, 24 Oct 2018 16:34:24 +0300	[thread overview]
Message-ID: <20181024133424.6heyete6laqecu66@tarantool.org> (raw)
In-Reply-To: <20181015100815.n4oxc3d4sv4ids7m@esperanza>

On 15 Oct 13:08, Vladimir Davydov wrote:
> On Fri, Oct 12, 2018 at 02:38:18PM +0300, Kirill Yukhin wrote:
> > Since SQL is heavily using name -> space mapping,
> > introduce (instead of scanning _space space) dedicated
> > cache, which maps space name to space pointer.
> > Update SQL sources thoroughly.
> > Remove function which deletes from cache, making replace
> > more general: it might be used for both insertions,
> > deletions and replaces.
> 
> Overall, I like the reasoning behind the patch, but IMO before doing
> this we need to cleanup the mess we have with schema object lookup
> functions.
> 
> See, we have <class>_by_name and <class>_by_id which look up an object
> of the corresponding class by the given name or id. Some of them set
> diag if the object isn't found, others not. I find it ugly. I think that
> either all or none of them should set diag.
> 
> Next, we have <class>_cache_find and <class>_find, which typically work
> as wrappers around <class>_by_id setting diag if the object isn't found.
> Sometimes (space_cache_find) they also cache the last returned object in
> a static variable. If we make <class>_by_id and <class>_by_name set
> diag, we won't be needing most of them. I think that we should only
> leave space_cache_find. May be, it's worth renaming it to make its
> purpose more obvious.
> 
> Please consider doing this cleanup first in a separate patch. It should
> be trivial. This should be done on top of 1.10 IMO.
We've discussed that verbally and came to the conclusion that its not
about time to do so. Need to evict EH first.


> Regarding the patch itself.
> 
>  - space_cache_replace should take the old space as the first argument
>    and the new space as the second argument, not vice versa. This would
>    be consistent with other 'replace' functions we have in Tarantool.

Done.

>  - Why would you need space_cache_delete and space_name_cache_delete if
>    you could use space_cache_replace instead. I mean,
> 
>    space_cache_replace(space, NULL); /* deletes the space */

Done.

>  - I guess that space_cache_replace shouldn't return anything.

Done.

>  - I think the change of space_cache_replace API should be done in a
>    separate patch.

Done.

>  - IMO you should replace box_space_id_by_name with space_by_name in a
>    separate patch.

Done.

I'll re-send updated 4-patch patchset as v2.

--
Regards, Kirill Yukhin

  reply	other threads:[~2018-10-24 13:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 11:38 [tarantool-patches] [PATCH v2 0/2] sql: check read access while executing SQL query Kirill Yukhin
2018-10-12 11:38 ` [tarantool-patches] [PATCH v2 1/2] Add space names cache Kirill Yukhin
2018-10-15 10:08   ` Vladimir Davydov
2018-10-24 13:34     ` Kirill Yukhin [this message]
2018-10-12 11:38 ` [tarantool-patches] [PATCH v2 2/2] sql: check read access while executing SQL query 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=20181024133424.6heyete6laqecu66@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] [PATCH v2 1/2] Add space names cache' \
    /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