Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com, Alexandr Lyapunov <aleks@tarantool.org>
Subject: Re: [tarantool-patches] [PATCH v2 4/4] box: introduce tuple compare hint for string index
Date: Thu, 14 Feb 2019 17:09:25 +0300	[thread overview]
Message-ID: <20190214140925.GD17583@chai> (raw)
In-Reply-To: <48f09c5c8f53bfa63a52da90ffe4672ade7ad9ae.1550050245.git.kshcherbatov@tarantool.org>

* Kirill Shcherbatov <kshcherbatov@tarantool.org> [19/02/13 13:03]:
> From: Alexandr Lyapunov <aleks@tarantool.org>
> diff --git a/src/box/key_def.c b/src/box/key_def.c
> index 9411ade39..ceca1ebee 100644
> --- a/src/box/key_def.c
> +++ b/src/box/key_def.c
> @@ -135,6 +135,7 @@ key_def_set_cmp(struct key_def *def)
>  	def->tuple_compare_with_key = tuple_compare_with_key_create(def);
>  	tuple_hash_func_set(def);
>  	tuple_extract_key_set(def);
> +	tuple_hint_set(def);

I think the name of the function is confusing. The name suggests
that it says a tuple hint, whereas it sets a function which
evaluates the hint. Please prepare a separate patch which renames
existing functions tuple_hash_func_set and tuple_extract_key_set
to
key_def_set_{tuple_extract_key_func|tuple_hash_func|tuple_hint_func}.

> +/** @copydoc tuple_hint() */
> +typedef uint64_t (*tuple_hint_t)(const struct tuple *tuple,
> +				 struct key_def *key_def);

The func typedef should end with _f not with _t.

> +
> +/** @copydoc key_hint() */
> +typedef uint64_t (*key_hint_t)(const char *key, struct key_def *key_def);

Same here.

> +static int
> +memtx_hinted_tree_data_cmp(struct memtx_hinted_tree_data *a,
> +			   struct memtx_hinted_tree_data *b,
> +			   struct key_def *key_def)
> +{
> +	if (a->hint != b->hint)
> +		return a->hint < b->hint ? -1 : 1;
> +	return tuple_compare(a->tuple, b->tuple, key_def);
> +}

Looks like we need null-aware hints as well, to preserve online null ->
not null alter semantics. 

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

  reply	other threads:[~2019-02-14 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  9:32 [PATCH v2 0/4] box: introduce hint option for memtx tree index Kirill Shcherbatov
2019-02-13  9:32 ` [PATCH v2 1/4] box: move memtx_tree implementation to source file Kirill Shcherbatov
2019-02-14 13:57   ` [tarantool-patches] " Konstantin Osipov
2019-02-21 13:26   ` Vladimir Davydov
2019-02-13  9:32 ` [PATCH v2 2/4] box: rework memtx_tree to store arbitrary nodes Kirill Shcherbatov
2019-02-21 15:01   ` Vladimir Davydov
2019-02-13  9:32 ` [PATCH v2 3/4] box: rename memtx_tree.c to memtx_tree_impl.h Kirill Shcherbatov
2019-02-13  9:32 ` [PATCH v2 4/4] box: introduce tuple compare hint for string index Kirill Shcherbatov
2019-02-14 14:09   ` Konstantin Osipov [this message]
2019-02-15 18:34   ` [tarantool-patches] " Kirill Shcherbatov
2019-02-19 15:01     ` [tarantool-patches] " Konstantin Osipov
2019-02-19 15:02     ` Kirill Shcherbatov
2019-02-21 16:06       ` 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=20190214140925.GD17583@chai \
    --to=kostja@tarantool.org \
    --cc=aleks@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] [PATCH v2 4/4] box: introduce tuple compare hint for string index' \
    /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