Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] tuple: turn invalid bar update into nop
Date: Tue, 14 Jul 2020 00:15:35 +0200	[thread overview]
Message-ID: <729aca75-411e-51b4-b6a8-d1ebd0fc6db0@tarantool.org> (raw)
In-Reply-To: <20200712231153.GC13229@tarantool.org>

Hi! Thanks for the review!

Pushed to master. See 2 answers below.

>> 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. 

I don't mind, changed to 'finish'.

>> +{
>> +	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.

Yeah, this is what I did, but still got all the diff. Because I
saved the operations array into a new variable 'ops', to avoid
the operations duplication. This changed the old lines as well.

  reply	other threads:[~2020-07-13 22:15 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
2020-07-13 22:15   ` Vladislav Shpilevoy [this message]
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=729aca75-411e-51b4-b6a8-d1ebd0fc6db0@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.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