From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v3 6/7] box: introduce field_map_builder class
Date: Wed, 3 Apr 2019 17:38:06 +0300 [thread overview]
Message-ID: <20190403143806.p3b5jjpw7nbv47qq@esperanza> (raw)
In-Reply-To: <51bd24d2df81ae0838dd74c96d35171b7824261e.1554218695.git.kshcherbatov@tarantool.org>
On Tue, Apr 02, 2019 at 06:49:37PM +0300, Kirill Shcherbatov wrote:
> diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> index 070897ec2..9a643b700 100644
> --- a/src/box/tuple_format.c
> +++ b/src/box/tuple_format.c
> @@ -769,27 +769,21 @@ tuple_format1_can_store_format2_tuples(struct tuple_format *format1,
>
> /** @sa declaration for details. */
> int
> -tuple_field_map_create(struct tuple_format *format, const char *tuple,
> - bool validate, uint32_t **field_map,
> - uint32_t *field_map_size)
> +tuple_field_map_create(struct field_map_builder *builder,
> + struct tuple_format *format, const char *tuple,
> + bool validate)
The field map builder should be the last in the argument list as it is
an out parameter.
> {
> + struct region *region = &fiber()->gc;
> if (tuple_format_field_count(format) == 0) {
> - *field_map = NULL;
> - *field_map_size = 0;
> + /* Nothing to initialize */
> + if (field_map_builder_create(builder, 0, region) != 0)
> + unreachable();
Nit: no need in this branching. You could create a builder with
format->field_map_size in both cases.
> return 0; /* Nothing to initialize */
> }
> - struct region *region = &fiber()->gc;
> - *field_map_size = format->field_map_size;
> - *field_map = region_alloc(region, *field_map_size);
> - if (*field_map == NULL) {
> - diag_set(OutOfMemory, *field_map_size, "region_alloc",
> - "field_map");
> + if (field_map_builder_create(builder, format->field_map_size,
> + region) != 0)
> return -1;
> - }
> - *field_map = (uint32_t *)((char *)*field_map + *field_map_size);
> -
> const char *pos = tuple;
> - int rc = 0;
> /* Check to see if the tuple has a sufficient number of fields. */
> uint32_t field_count = mp_decode_array(&pos);
> if (validate && format->exact_field_count > 0 &&
> diff --git a/src/box/tuple_format.h b/src/box/tuple_format.h
> index bef1d0903..88f03d5eb 100644
> --- a/src/box/tuple_format.h
> +++ b/src/box/tuple_format.h
> @@ -36,6 +36,7 @@
> #include "errinj.h"
> #include "json/json.h"
> #include "tuple_dictionary.h"
> +#include "field_map.h"
>
> #if defined(__cplusplus)
> extern "C" {
> @@ -169,8 +170,9 @@ struct tuple_format {
> */
> bool is_ephemeral;
> /**
> - * Size of field map of tuple in bytes.
> - * \sa struct tuple
> + * Size of minimal field map of tuple where each indexed
> + * field has own offset slot (in bytes).
> + * \sa struct field_map_builder
> */
Minimal? What's that supposed to mean? Is it from the next patch?
Other than that, looks okay to me.
next prev parent reply other threads:[~2019-04-03 14:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 15:49 [PATCH v3 0/7] box: introduce multikey indexes in memtx Kirill Shcherbatov
2019-04-02 15:49 ` [PATCH v3 1/7] box: cleanup key_def virtual extract_key setter Kirill Shcherbatov
2019-04-03 12:42 ` Vladimir Davydov
2019-04-03 16:22 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-03 18:01 ` Vladimir Davydov
2019-04-02 15:49 ` [PATCH v3 2/7] lib: introduce a new json_path_multikey_offset helper Kirill Shcherbatov
2019-04-03 12:56 ` Vladimir Davydov
2019-04-03 16:22 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-03 18:02 ` Vladimir Davydov
2019-04-04 6:17 ` Konstantin Osipov
2019-04-02 15:49 ` [PATCH v3 3/7] box: move offset_slot init to tuple_format_add_field Kirill Shcherbatov
2019-04-03 12:57 ` Vladimir Davydov
2019-04-03 18:02 ` Vladimir Davydov
2019-04-04 6:19 ` [tarantool-patches] " Konstantin Osipov
2019-04-05 17:17 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-02 15:49 ` [PATCH v3 4/7] lib: update msgpuck library Kirill Shcherbatov
2019-04-03 17:49 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-04 15:54 ` Vladimir Davydov
2019-04-05 17:17 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-07 12:22 ` Vladimir Davydov
2019-04-02 15:49 ` [PATCH v3 5/7] box: introduce tuple_parse_iterator class Kirill Shcherbatov
2019-04-03 14:04 ` Vladimir Davydov
2019-04-05 17:17 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-02 15:49 ` [PATCH v3 6/7] box: introduce field_map_builder class Kirill Shcherbatov
2019-04-03 14:38 ` Vladimir Davydov [this message]
2019-04-05 17:17 ` [tarantool-patches] " Kirill Shcherbatov
2019-04-03 16:30 ` Vladimir Davydov
2019-04-02 15:49 ` [PATCH v3 7/7] box: introduce multikey indexes in memtx Kirill Shcherbatov
2019-04-04 14:20 ` 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=20190403143806.p3b5jjpw7nbv47qq@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH v3 6/7] box: introduce field_map_builder class' \
/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