Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] tuple: turn invalid bar update into nop
Date: Sun, 12 Jul 2020 23:11:53 +0000	[thread overview]
Message-ID: <20200712231153.GC13229@tarantool.org> (raw)
In-Reply-To: <e32f85595b4fce26790dccf5968ed1405e2eda86.1593883084.git.v.shpilevoy@tarantool.org>

On 04 Jul 19:20, Vladislav Shpilevoy wrote:

LGTM

> While working on this I found an inconsistency in which errors do
> we ignore. https://github.com/tarantool/tarantool/issues/5137

Great!
 
> diff --git a/src/box/xrow_update_bar.c b/src/box/xrow_update_bar.c
> index 0033f0044..1d20d6c74 100644
> --- a/src/box/xrow_update_bar.c
> +++ b/src/box/xrow_update_bar.c
> @@ -31,6 +31,22 @@
>  #include "xrow_update_field.h"
>  #include "tuple.h"
>  
> +/**
> + * 'Commit' bar creation only when it is fully initialized and
> + * valid. Because if all this is happening inside an upsert()
> + * operation, it won't stop the whole xrow upsert. This field will
> + * still be saved in the result tuple. But in case of an error
> + * this operation should be skipped. So this is kept 'nop' when
> + * error happens.
> + */
> +static inline int
> +xrow_update_bar_commit(struct xrow_update_field *field)

Mb _done/_finish are better names? Up to you. 

> +{
> +	assert(field->type == XUPDATE_NOP);
> +	field->type = XUPDATE_BAR;
> +	return 0;
> +}
> +
>  /**
>   * Locate a field to update by @a op's JSON path and initialize
>   * @a field as a bar update.
> diff --git a/test/box/update.test.lua b/test/box/update.test.lua
> index 1538cae9c..27cf55467 100644
> --- a/test/box/update.test.lua
> +++ b/test/box/update.test.lua
> @@ -343,20 +343,52 @@ t2:update({{'!', 'g[6][1]', 50}})
>  t4_array:update({{'!', '[4][1]', 100}})
>  t4_map:update({{'!', '[4].a', 100}})
>  -- Test errors.
> -t:update({{'!', 'a', 100}}) -- No such field.
> -t:update({{'!', 'f.a', 300}}) -- Key already exists.
> -t:update({{'!', 'f.c.f[0]', 3.5}}) -- No such index, too small.
> -t:update({{'!', 'f.c.f[100]', 100}}) -- No such index, too big.
> -t:update({{'!', 'g[4][100]', 700}}) -- Insert index into map.
> -t:update({{'!', 'g[1][1]', 300}})
> -t:update({{'!', 'f.g.a', 700}}) -- Insert key into array.
> -t:update({{'!', 'f.g[1].a', 700}})
> -t:update({{'!', 'f[*].k', 20}}) -- 'Any' is not considered valid JSON.

New tests are cool, but mb it is worth reducing diff by placing
new tests right after old ones? Don't insist tho.

  reply	other threads:[~2020-07-12 23:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-04 17:20 Vladislav Shpilevoy
2020-07-12 23:11 ` Nikita Pettik [this message]
2020-07-13 22:15   ` Vladislav Shpilevoy
2020-07-20 19:42 ` Vladislav Shpilevoy

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=20200712231153.GC13229@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/1] tuple: turn invalid bar update into nop' \
    /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