From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 13 Aug 2019 13:56:29 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH 07/13] memtx: use ref counting to pin indexes for snapshot Message-ID: <20190813105629.GA13834@esperanza> References: <20190812222420.GZ32337@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190812222420.GZ32337@atlas> To: Konstantin Osipov Cc: tarantool-patches@freelists.org List-ID: On Tue, Aug 13, 2019 at 01:24:20AM +0300, Konstantin Osipov wrote: > * Vladimir Davydov [19/08/10 23:22]: > > Currently, to prevent an index from going away while it is being > > written to a snapshot, we postpone memtx_gc_task's free() invocation > > until checkpointing is complete, see commit 94de0a081b3a ("Don't take > > schema lock for checkpointing"). This works fine, but makes it rather > > difficult to reuse snapshot iterators for other purposes, e.g. feeding > > a consistent read view to a newly joined replica. > > > > Let's instead use index reference counting for pinning indexes for > > checkpointing. A reference is taken in a snapshot iterator constructor > > and released when the snapshot iterator is destroyed. > > I don't see how this can work in general, memtx index can not live > without memtx space and tuple format. These are not referenced > from the index object. A memtx index doesn't need to reference a space - we move indexes from space to sapce on alter without any problems. Regarding the tuple format, it is referenced by tuples anyway while tuples are referenced by the primary index so we don't need to reference it explicitly.