Tarantool development patches archive
 help / color / mirror / Atom feed
From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 1/2] vinyl: rework upsert operation
Date: Wed, 14 Oct 2020 14:47:20 +0300	[thread overview]
Message-ID: <0724fa81-2b0a-4aec-48d6-dc6059e7386f@tarantool.org> (raw)
In-Reply-To: <20201014104222.GA23071@tarantool.org>

Great, LGTM!

On 10/14/20 1:42 PM, Nikita Pettik wrote:
> On 14 Oct 11:58, Aleksandr Lyapunov wrote:
>>>           if (stmt_is_void) {
>>>                   ups_cnt--;
>>>                   mp_next(&ups_ops);
>>> +               stmt = vy_stmt_new_replace(tuple_format(upsert), result_mp,
>>> +                                          result_mp_end);
>> Why can't you just use `upsert` tuple itself instead of created tuple by its
>> format and data?
>>
> For sure we can. Sorry it was late night so I didn't pay attention to this fact.
> Diff:
>
> diff --git a/src/box/vy_upsert.c b/src/box/vy_upsert.c
> index 0b4baf6ff..fdae931f6 100644
> --- a/src/box/vy_upsert.c
> +++ b/src/box/vy_upsert.c
> @@ -102,15 +102,13 @@ vy_apply_upsert_on_terminal_stmt(struct tuple *upsert, struct tuple *stmt,
>          const char *ups_ops = new_ops;
>          /*
>           * In case upsert folds into insert, we must skip first
> -        * update operations. Moreover, we should create (in case of delete
> -        * statement - re-create since delete contains only key) tuple with
> -        * format to use it for PK modification check.
> +        * update operations. Moreover, we should use upsert's tuple
> +        * to provide PK modification check.
>           */
>          if (stmt_is_void) {
>                  ups_cnt--;
>                  mp_next(&ups_ops);
> -               stmt = vy_stmt_new_replace(tuple_format(upsert), result_mp,
> -                                          result_mp_end);
> +               stmt = upsert;
>          }
>          for (uint32_t i = 0; i < ups_cnt; ++i) {
>                  assert(mp_typeof(*ups_ops) == MP_ARRAY);
> @@ -126,8 +124,6 @@ vy_apply_upsert_on_terminal_stmt(struct tuple *upsert, struct tuple *stmt,
>                                  assert(e != NULL);
>                                  /* Bail out immediately in case of OOM. */
>                                  if (e->type != &type_ClientError) {
> -                                       if (stmt_is_void)
> -                                               tuple_unref(stmt);
>                                          region_truncate(region, region_svp);
>                                          return NULL;
>                                  }
> @@ -169,8 +165,6 @@ vy_apply_upsert_on_terminal_stmt(struct tuple *upsert, struct tuple *stmt,
>          struct tuple *new_terminal_stmt = vy_stmt_new_replace(format, result_mp,
>                                                                result_mp_end);
>          region_truncate(region, region_svp);
> -       if (stmt_is_void)
> -               tuple_unref(stmt);
>          if (new_terminal_stmt == NULL)
>                  return NULL;
>          vy_stmt_set_lsn(new_terminal_stmt, vy_stmt_lsn(upsert));
>
>   

  reply	other threads:[~2020-10-14 11:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 13:28 [Tarantool-patches] [PATCH v3 0/2] " Nikita Pettik
2020-10-03 13:28 ` [Tarantool-patches] [PATCH v3 1/2] " Nikita Pettik
2020-10-06 22:12   ` Vladislav Shpilevoy
2020-10-09 15:06     ` Nikita Pettik
2020-10-13 19:00   ` Aleksandr Lyapunov
2020-10-14  0:15     ` Nikita Pettik
2020-10-14  8:58       ` Aleksandr Lyapunov
2020-10-14 10:42         ` Nikita Pettik
2020-10-14 11:47           ` Aleksandr Lyapunov [this message]
2020-10-15  0:36             ` Nikita Pettik
2020-10-03 13:28 ` [Tarantool-patches] [PATCH v3 2/2] vinyl: remove squash procedures from source code Nikita Pettik
2020-10-03 13:52 ` [Tarantool-patches] [PATCH v3 0/2] vinyl: rework upsert operation Nikita Pettik
2020-10-06 22:12 ` Vladislav Shpilevoy
2020-10-09 15:10   ` Nikita Pettik
2020-10-11 15:35     ` Vladislav Shpilevoy
2020-10-11 15:35 ` Vladislav Shpilevoy
2020-10-13 10:18   ` Nikita Pettik
2020-10-14 23:44     ` Vladislav Shpilevoy
2020-10-15  1:42       ` 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=0724fa81-2b0a-4aec-48d6-dc6059e7386f@tarantool.org \
    --to=alyapunov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 1/2] vinyl: rework upsert operation' \
    /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