Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Tarantool MailList <tarantool-patches@freelists.org>
Subject: Re: [tarantool-patches] Re: [PATCH v3 2/4] box: introduce slot_cache in key_part
Date: Mon, 17 Sep 2018 20:08:58 +0300	[thread overview]
Message-ID: <20180917170858.u6zw7asvnibss56s@esperanza> (raw)
In-Reply-To: <f38dcc3b-341b-846a-a3fe-c49c7ae21c6f@tarantool.org>

It looks like you plucked some random parts from the main patch just to
make it look smaller. Please don't do that, because it doesn't make it
any easier to review. Split a patch set so that each individual patch
makes sense and can be applied independently.

I see at least two separate things you're doing here that could be
committed after the first review iteration:

 1. Deconstantifying key_def throughout the code.
 2. Introducing tuple_field_by_part helper.

Please factor out those parts in separate patches and write a brief
descriptive comment to each of them (what you're doing in a nutshell and
why). Before you do that, I can't review this patch without risking to
miss something critical.

A few things that I did manage to notice:

 - You add has_json_path template parameter to comparators. This looks
   completely out-of-place. I think this change should go along with the
   patch that implements json path indexes.

 - Although offset_slot and offset_slot_epoch are added to key_part,
   they are never used. Looks like this also should go to another patch.
   May be, it's worth factoring out the 'epoch' optimization to a
   separate patch that would be applied on top of json indexes - after
   all, it's just an optimization, right?

 - The epoch is really easy to miss when creating a tuple format:

> @@ -158,6 +158,7 @@ blackhole_engine_create_space(struct engine *engine, struct space_def *def,
>  		return NULL;
>  	}
>  	format->exact_field_count = def->exact_field_count;
> +	format->epoch = ++epoch;

   I think it should be passed as an argument to tuple_format_new.
   Also, IMO it'd be more straightforward to pass the actual epoch
   that should be used for the new format, not the previous one.

 - In tuple_common_key_parts the following type cast isn't needed:

> +		struct key_part *part = (struct key_part *)&key_def->parts[i];


On Thu, Sep 06, 2018 at 03:47:09PM +0300, Kirill Shcherbatov wrote:
> From 996ee351112bb070d511636bc702496bc445f047 Mon Sep 17 00:00:00 2001
> Message-Id: <996ee351112bb070d511636bc702496bc445f047.1536237903.git.kshcherbatov@tarantool.org>
> In-Reply-To: <cover.1536237903.git.kshcherbatov@tarantool.org>
> References: <cover.1536237903.git.kshcherbatov@tarantool.org>
> From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
> Date: Thu, 9 Aug 2018 15:02:44 +0300
> Subject: [PATCH 2/4] box: introduce slot_cache in key_part
> 
> Same key_part could be used in different formats multiple
> times, so different field->offset_slot would be allocated.
> In most scenarios we work with series of tuples of same
> format, and (in general) format lookup for field would be
> expensive operation for JSON-paths defined in key_part.
> New slot_cache field in key_part structure and epoch-based
> mechanism to validate it actuality should be effective
> approach to improve performance.
> New routine tuple_field_by_part use tuple and key_part
> to access field that allows to rework and speedup all
> scenarios of access tuple data by index.
> This also allows to work with JSON-path key_parts later.
> 
> Part of #1012.
> ---
>  src/box/alter.cc             |   6 +-
>  src/box/blackhole.c          |   3 +-
>  src/box/engine.h             |  11 ++--
>  src/box/key_def.c            |  16 +++--
>  src/box/key_def.h            |  38 +++++++-----
>  src/box/memtx_bitset.c       |   5 +-
>  src/box/memtx_engine.c       |   4 +-
>  src/box/memtx_hash.h         |   4 +-
>  src/box/memtx_rtree.c        |   3 +-
>  src/box/memtx_space.c        |   3 +-
>  src/box/memtx_space.h        |   2 +-
>  src/box/schema.cc            |   4 +-
>  src/box/space.c              |   4 +-
>  src/box/space.h              |   8 ++-
>  src/box/sysview.c            |   3 +-
>  src/box/tuple.h              |  14 +++++
>  src/box/tuple_bloom.c        |   8 +--
>  src/box/tuple_bloom.h        |   8 +--
>  src/box/tuple_compare.cc     | 141 ++++++++++++++++++++++++++-----------------
>  src/box/tuple_compare.h      |   5 +-
>  src/box/tuple_extract_key.cc |  53 +++++++++-------
>  src/box/tuple_format.c       |  12 ++++
>  src/box/tuple_format.h       |  18 ++++++
>  src/box/tuple_hash.cc        |  63 ++++++++++++-------
>  src/box/tuple_hash.h         |   9 ++-
>  src/box/vinyl.c              |   3 +-
>  src/box/vy_history.c         |   2 +-
>  src/box/vy_history.h         |   2 +-
>  src/box/vy_lsm.c             |   2 +
>  src/box/vy_mem.c             |   8 +--
>  src/box/vy_mem.h             |  10 +--
>  src/box/vy_range.c           |   2 +-
>  src/box/vy_range.h           |   4 +-
>  src/box/vy_run.c             |  39 ++++++------
>  src/box/vy_run.h             |  34 +++++------
>  src/box/vy_stmt.c            |  15 ++---
>  src/box/vy_stmt.h            |  39 ++++++------
>  src/box/vy_upsert.c          |   2 +-
>  src/box/vy_upsert.h          |   2 +-
>  src/box/vy_write_iterator.c  |   8 +--
>  src/box/vy_write_iterator.h  |   6 +-
>  41 files changed, 374 insertions(+), 249 deletions(-)

  reply	other threads:[~2018-09-17 17:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27  7:37 [tarantool-patches] [PATCH v3 0/4] box: indexes by JSON path Kirill Shcherbatov
2018-08-27  7:37 ` [tarantool-patches] [PATCH v3 1/4] rfc: describe a Tarantool JSON indexes Kirill Shcherbatov
2018-08-27  7:37 ` [tarantool-patches] [PATCH v3 2/4] box: introduce slot_cache in key_part Kirill Shcherbatov
2018-09-03 10:35   ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-06 12:47     ` Kirill Shcherbatov
2018-09-17 17:08       ` Vladimir Davydov [this message]
2018-08-27  7:37 ` [tarantool-patches] [PATCH v3 3/4] box: introduce JSON indexes Kirill Shcherbatov
2018-09-03 10:32   ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-03 10:35     ` Vladislav Shpilevoy
2018-09-06 12:46     ` Kirill Shcherbatov
2018-08-27  7:37 ` [tarantool-patches] [PATCH v3 4/4] box: specify indexes in user-friendly form Kirill Shcherbatov
2018-09-03 10:32   ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-06 12:46     ` Kirill Shcherbatov
2018-09-17 15:50 ` [tarantool-patches] [PATCH v3 0/4] box: indexes by JSON path Vladimir Davydov

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=20180917170858.u6zw7asvnibss56s@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] Re: [PATCH v3 2/4] box: introduce slot_cache in key_part' \
    /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