[Tarantool-patches] [PATCH v3 2/3] vinyl: clean-up unprocessed read views in *_build_read_views()

Nikita Pettik korablev at tarantool.org
Thu May 7 15:28:05 MSK 2020


On 07 May 11:44, Aleksandr Lyapunov wrote:
> 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!

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

Oh, it's misprint for sure. Fixed.



More information about the Tarantool-patches mailing list