From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 8B4134696C4 for ; Mon, 27 Apr 2020 03:53:59 +0300 (MSK) Date: Mon, 27 Apr 2020 00:53:58 +0000 From: Nikita Pettik Message-ID: <20200427005358.GA28450@tarantool.org> References: <1bfd4b8d73192086bb351e216386fcd221acff27.1586902245.git.korablev@tarantool.org> <4a23b20f-193f-c3d4-fa05-eab17f5e2f60@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4a23b20f-193f-c3d4-fa05-eab17f5e2f60@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 2/2] vinyl: clean-up unprocessed read views in *_build_read_views() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org On 19 Apr 17:31, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch! > > See 2 comments below. > > > diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c > > index 7a6a20627..910e5a062 100644 > > --- a/src/box/vy_write_iterator.c > > +++ b/src/box/vy_write_iterator.c > > @@ -790,8 +790,11 @@ next_lsn: > > * statement around if this is major compaction, because > > * there's no tuple it could overwrite. > > */ > > - if (rc == 0 && stream->is_last_level && > > - stream->deferred_delete_stmt != NULL) { > > + if (rc != 0) { > > + for (int i = 0; i < stream->rv_count; ++i) > > + stream->read_views[i].history = NULL; > > 1. Why are we sure it is safe to nullify the read view histories in > case of a fail? Looks like they can keep tuples which should be > unreferenced. If it would be enough to nullify them, we could > just do the same in vy_write_iterator_stop(). But it calls > vy_write_history_destroy() before nullification. > > Why is not it called here? The same question for vy_read_view_merge(). You are absolutely right. Thanks, fixed (see updated patch in v3). > > @@ -834,6 +837,15 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, > > rv->history = NULL; > > return 0; > > } > > +#ifndef NDEBUG > > + struct errinj *inj = > > + errinj(ERRINJ_VY_READ_VIEW_MERGE_FAIL, ERRINJ_BOOL); > > + if (inj != NULL && inj->bparam) { > > + inj->bparam = false; > > + diag_set(OutOfMemory, 666, "malloc", "struct vy_stmt"); > > + return -1; > > + } > > 2. Indentation is too big. Fixed.