Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 1/2] box: speed up tuple_field_map_create
Date: Thu, 10 Dec 2020 17:17:02 +0000	[thread overview]
Message-ID: <20201210171702.GC1319@tarantool.org> (raw)
In-Reply-To: <5b3a70820a00cdfa26189933a4ae0549a0398c72.1607075291.git.sergepetrenko@tarantool.org>

On 04 Dec 12:52, Serge Petrenko wrote:
> +static int
> +tuple_field_map_create_plain(struct tuple_format *format, const char *tuple,
> +			     bool validate, struct field_map_builder *builder)
> +{
> +	struct region *region = &fiber()->gc;
> +	const char *pos = tuple;
> +	uint32_t defined_field_count = mp_decode_array(&pos);
> +	if (validate && format->exact_field_count > 0 &&
> +	    format->exact_field_count != defined_field_count) {
> +		diag_set(ClientError, ER_EXACT_FIELD_COUNT,
> +			 (unsigned) defined_field_count,
> +			 (unsigned) format->exact_field_count);
> +		return -1;
> +	}
> +	defined_field_count = MIN(defined_field_count,

I'd rewrite this part as:

diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
index 6c9b2a255..d6655256a 100644
--- a/src/box/tuple_format.c
+++ b/src/box/tuple_format.c
@@ -912,10 +912,12 @@ tuple_field_map_create_plain(struct tuple_format *format, const char *tuple,
        }
 
 end:
-       return validate ?
-              tuple_format_required_fields_validate(format, required_fields,
-                                                    required_fields_sz) :
-              0;
+       if (validate) {
+               return tuple_format_required_fields_validate(format,
+                                                            required_fields,
+                                                            required_fields_sz);
+       }
+       return 0;
 }
 

Up to you. Anyway LGTM

> +end:
> +	return validate ?
> +	       tuple_format_required_fields_validate(format, required_fields,
> +						     required_fields_sz) :
> +	       0;
> +}
> +

  reply	other threads:[~2020-12-10 17:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04  9:52 [Tarantool-patches] [PATCH v3 0/2] reduce performance degradation introduced by JSON path indices Serge Petrenko
2020-12-04  9:52 ` [Tarantool-patches] [PATCH v3 1/2] box: speed up tuple_field_map_create Serge Petrenko
2020-12-10 17:17   ` Nikita Pettik [this message]
2020-12-11  6:34     ` Serge Petrenko
2020-12-11 14:32       ` Nikita Pettik
2020-12-04  9:52 ` [Tarantool-patches] [PATCH v3 2/2] box: refactor tuple_field_raw to omit path checks Serge Petrenko
2020-12-10 17:25   ` Nikita Pettik
2020-12-11  6:36     ` Serge Petrenko
2020-12-10 17:35 ` [Tarantool-patches] [PATCH v3 0/2] reduce performance degradation introduced by JSON path indices Nikita Pettik
2020-12-11  6:47   ` Serge Petrenko
2020-12-11 13:39   ` Alexander V. Tikhonov
2020-12-11 14:51     ` Nikita Pettik

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=20201210171702.GC1319@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 1/2] box: speed up tuple_field_map_create' \
    /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