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 2/3] vinyl: clean-up unprocessed read views in *_build_read_views()
Date: Thu, 7 May 2020 11:44:36 +0300	[thread overview]
Message-ID: <932b750d-abd7-1de9-1654-2781ac49a6ba@tarantool.org> (raw)
In-Reply-To: <20200507002922.GA9992@tarantool.org>

Thanks for the patch! Almost perfect, except some looking like a 
misprint, see my comments below.

On 5/7/20 3:29 AM, Nikita Pettik wrote:
>
> On the other hand clean-up provided by vy_read_view_stmt_destroy()
> is safe: it nullifies rv->tuple and rv->history so that next call
> of vy_read_view_stmt_destroy() will be no-op in fact.
> Anyway, I've refactored this code according to your plan, so
> vy_read_view_stmt_destroy() now unrefs only resulting tuple.
Yes, as I said your code was correct, but I'm talking about good structure
of the code that is easier to support and (I hope) leave less chances
to make a mistake or forget something like cleanup. Divide responsibility
between parts of code and conquer!
>
>> 2. The history must be destructed after call to
>> vy_write_iterator_build_history in any case,
>> whether an error occurred or not (comment about it?).
> But histories are used in vy_read_view_merge(). Do you mean destruct all
> histories after they are processed (i.e. before region_truncate())?
Exactly, in the end of vy_write_iterator_build_read_views.
>
> -       if (rc != 0) {
> -               for (int i = 0; i < stream->rv_count; ++i)
> -                       vy_read_view_stmt_destroy(&stream->read_views[i]);
> -       } else if (stream->is_last_level &&
> -                  stream->deferred_delete_stmt != NULL) {
> +       if (stream->is_last_level && stream->deferred_delete_stmt != NULL) {
>                  vy_stmt_unref_if_possible(stream->deferred_delete_stmt);
>                  stream->deferred_delete_stmt = NULL;
>          }
Originally it was:

if (rc == 0 && stream->is_last_level && stream->deferred_delete_stmt != NULL)

Are you sure you want to change it, or it was a misprint?.

  reply	other threads:[~2020-05-07  8:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27  0:52 [Tarantool-patches] [PATCH v3 0/3] vinyl: fix uninitialized memory accesses Nikita Pettik
2020-04-27  0:52 ` [Tarantool-patches] [PATCH v3 1/3] vinyl: init all vars before cleanup in vy_lsm_split_range() Nikita Pettik
2020-05-06  9:04   ` Aleksandr Lyapunov
2020-05-06 13:12     ` Nikita Pettik
2020-05-06 17:52       ` Aleksandr Lyapunov
2020-05-07  1:09         ` Nikita Pettik
2020-04-27  0:52 ` [Tarantool-patches] [PATCH v3 2/3] vinyl: clean-up unprocessed read views in *_build_read_views() Nikita Pettik
2020-05-06  9:56   ` Aleksandr Lyapunov
2020-05-07  0:29     ` Nikita Pettik
2020-05-07  8:44       ` Aleksandr Lyapunov [this message]
2020-05-07 12:28         ` Nikita Pettik
2020-04-27  0:52 ` [Tarantool-patches] [PATCH v3 3/3] vinyl: clean-up write iterator if vy_task_write_run() fails Nikita Pettik
2020-05-01  0:55   ` Vladislav Shpilevoy
2020-05-03  9:22     ` Konstantin Osipov
2020-05-07  0:38     ` Nikita Pettik
2020-05-06 10:37   ` Aleksandr Lyapunov
2020-05-07  0:36     ` Nikita Pettik
2020-05-07  7:53       ` Aleksandr Lyapunov
2020-05-07 22:16         ` Nikita Pettik
2020-05-08 16:29           ` Aleksandr Lyapunov

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=932b750d-abd7-1de9-1654-2781ac49a6ba@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 2/3] vinyl: clean-up unprocessed read views in *_build_read_views()' \
    /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