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 2/2] vinyl: clean-up read views if *_build_history() fails
Date: Mon, 13 Apr 2020 22:11:01 +0000	[thread overview]
Message-ID: <20200413221101.GA24818@tarantool.org> (raw)
In-Reply-To: <814d82af-87cd-e464-6845-88535bd374f5@tarantool.org>

On 11 Apr 00:32, Vladislav Shpilevoy wrote:
> 
> 
> On 10/04/2020 23:45, Nikita Pettik wrote:
> > On 10 Apr 15:47, Nikita Pettik wrote:
> > 
> > I've also found that vy_read_view_merge() can fail as well during
> > processing array of read views. Thus, we should clean-up unprocessed
> > read views as well. Diff:
> > 
> > diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c
> > index 7d8c60d73..165b422fd 100644
> > --- a/src/box/vy_write_iterator.c
> > +++ b/src/box/vy_write_iterator.c
> > @@ -986,8 +986,11 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count)
> >                 if (rv->history == NULL)
> >                         continue;
> >                 if (vy_read_view_merge(stream, hint, rv,
> > -                                      is_first_insert) != 0)
> > +                                      is_first_insert) != 0) {
> > +                       while (rv >= &stream->read_views[0]) {
> > +                               rv->history = NULL;
> > +                               rv--;
> > +                       }
> >                         goto error;
> 
> The same question as to the previous fix - shouldn't that be
> cleaned by the function, which created the mess, by
> vy_read_view_merge() internally?

Iteration over read views takes place in _build_read_views() so
to me it seems to be sensible to clean-up it there..
In fact, view_merge() does not create mess. Moreover, it doesn't
even have explicit access to array of read views (only via
stream->read_views[]) - read view to be processed is passed as a
separate parameter. Purpose of view_merge() is to merge statements,
so why it should clean-up read-views which belong to stream object?
All in all, I do not see much sense to move this clean-up to
read_view_merge(), only if you insist on this change.

> > +               }
> >                 assert(rv->history == NULL);
> >                 if (rv->tuple == NULL)
> >                         continue;
> > 

  parent reply	other threads:[~2020-04-13 22:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 21:37 [Tarantool-patches] [PATCH 0/2] vinyl: fix uninitialized memory accesses Nikita Pettik
2020-04-08 21:37 ` [Tarantool-patches] [PATCH 1/2] vinyl: init all vars before cleanup in vy_lsm_split_range() Nikita Pettik
2020-04-09  8:18   ` Konstantin Osipov
2020-04-09 10:55     ` Nikita Pettik
2020-04-09 11:07       ` Konstantin Osipov
2020-04-09 11:26         ` Nikita Pettik
2020-04-10 15:13   ` Vladislav Shpilevoy
2020-04-10 15:40     ` Nikita Pettik
2020-04-10 18:24       ` Nikita Pettik
2020-04-11 17:39       ` Vladislav Shpilevoy
2020-04-13 22:29         ` Nikita Pettik
2020-04-14 21:40           ` Nikita Pettik
2020-04-08 21:37 ` [Tarantool-patches] [PATCH 2/2] vinyl: clean-up read views if *_build_history() fails Nikita Pettik
2020-04-09  8:19   ` Konstantin Osipov
2020-04-09 11:09     ` Nikita Pettik
2020-04-10 15:13   ` Vladislav Shpilevoy
2020-04-10 15:47     ` Nikita Pettik
2020-04-10 21:45       ` Nikita Pettik
2020-04-10 22:32         ` Vladislav Shpilevoy
2020-04-11 17:30           ` Konstantin Osipov
2020-04-13 22:31             ` Nikita Pettik
2020-04-13 22:35               ` Konstantin Osipov
2020-04-13 22:11           ` Nikita Pettik [this message]
2020-04-11 17:39       ` 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=20200413221101.GA24818@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] vinyl: clean-up read views if *_build_history() fails' \
    /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