From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 21 Aug 2018 18:37:54 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2 2/7] vinyl: teach write iterator to return overwritten tuples Message-ID: <20180821153754.xy6m5mtzzozhdxrg@esperanza> References: <20180821151457.GB28159@chai> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180821151457.GB28159@chai> To: Konstantin Osipov Cc: tarantool-patches@freelists.org List-ID: On Tue, Aug 21, 2018 at 06:14:57PM +0300, Konstantin Osipov wrote: > * Vladimir Davydov [18/08/21 15:19]: > > /* > > + * Deferred DELETE statements can only be produced by > > + * primary index compaction. > > + */ > > + assert(is_primary || handler == NULL); > > + /* > > With this assert, do you really need this check: > > > +static int > > +vy_write_iterator_deferred_delete(struct vy_write_iterator *stream, > > + struct tuple *stmt) > > +{ > > + if (!stream->is_primary) > > + return 0; > > ? Yes. When we dump a primary index, we set 'handler' to NULL, just like for a secondary index, but in contrast to a secondary index, we have to include the last statement marked as VY_STMT_DEFERRED_DELETE into the iterator output even if it is not referenced by any read view, because we will need it to generate a deferred DELETE statement on compaction.