From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <korablev@tarantool.org>
Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by dev.tarantool.org (Postfix) with ESMTPS id 0ECE64696C3
 for <tarantool-patches@dev.tarantool.org>;
 Thu,  9 Apr 2020 14:09:33 +0300 (MSK)
Date: Thu, 9 Apr 2020 11:09:32 +0000
From: Nikita Pettik <korablev@tarantool.org>
Message-ID: <20200409110932.GB3864@tarantool.org>
References: <cover.1586381297.git.korablev@tarantool.org>
 <73e1f0baf18ec008312d91db4449447b3c06aa86.1586381297.git.korablev@tarantool.org>
 <20200409081923.GB21437@atlas>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20200409081923.GB21437@atlas>
Subject: Re: [Tarantool-patches] [PATCH 2/2] vinyl: clean-up read views if
	*_build_history() fails
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Konstantin Osipov <kostja.osipov@gmail.com>, tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org

On 09 Apr 11:19, Konstantin Osipov wrote:
> * Nikita Pettik <korablev@tarantool.org> [20/04/09 00:39]:
> >  	if (vy_write_iterator_build_history(stream, &raw_count,
> > -					    &is_first_insert) != 0)
> > +					    &is_first_insert) != 0) {
> > +		for (int i = 0; i < stream->rv_count; ++i)
> > +			stream->read_views[i].history = NULL;
> 
> This violates stream encapsulation and should be a method of the
> stream. 

read_views is a member of write_iterator, not stream. Stream has
only for methods: start, next, stop, close.
vy_write_iterator_build_history() is a part of next method. So it
is likely to be already encapsulated, isn't it? Access to truncated
region memory occurs in stop() method (i.e. write_iterator_stop()).
 
> Otherwise lgtm.
> 
> 
> -- 
> Konstantin Osipov, Moscow, Russia