From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 4DAFD469710 for ; Fri, 5 Jun 2020 01:32:06 +0300 (MSK) Date: Thu, 4 Jun 2020 22:32:05 +0000 From: Nikita Pettik Message-ID: <20200604223205.GA23443@tarantool.org> References: <7407b62139349ee3904a674490a6222b0c960a1c.1591292549.git.korablev@tarantool.org> <20200604202309.GA146885@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200604202309.GA146885@atlas> Subject: Re: [Tarantool-patches] [PATCH] vinyl: rotate mem during index build on demand List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konstantin Osipov , tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, alyapunov@tarantool.org On 04 Jun 23:23, Konstantin Osipov wrote: > * Nikita Pettik [20/06/04 20:49]: > > Meanwhile in 17f6af7dc the similar problem has been fixed, still it may > > appear that in-memory level of secondary index being constructed has > > lagging memory generation (in other words, it's values is less than > > the value of current global generation). Such situation can be achieved > > if yield which is required to check uniqueness of value being inserted > > is too long. In this time gap other space may trigger dump process > > bumping global memory generation counter, but dump itself is still not > > yet scheduled. > > It's hard for me to understand this comment, perhaps > you discussed the problem verbally, but I'm a bit out of context. > > Could you write it using an event diagram, something like: > > user1 user2 vy_scheduler > > insert ... > create_index() > > > yield > dump > > ??? > Sure. In the first case vy_scheduler fiber is not waked up during yield in vy_build_insert_tuple(): user1 user2 scheduler generation s1:create_index --- idle n yield(*_insert_tuple) s2:insert() idle n yield *_trigger_dump() idle n+1 yield s2:rotate_mem() idle n+1 yield --- idle n+1 s1:*_insert_tuple continue --- idle n+1 ^ | s1 still has mem generation n, meanwhile global and s2 generations is n+1. Since we can't schedule fibers (and can't provide guarantee that vy_scheduler fiber won't wake up), to reproduce the problem let's assume that vy_task_dump_new fails for whatever reason: user1 user2 scheduler generation s1:create_index --- idle n yield(*_insert_tuple) s2:insert() idle n yield *_trigger_dump() idle n+1 yield --- vy_task_dump_new n+1 yield --- throttled n+1 s1:*_insert_tuple continue --- throttled n+1 Again s1 has mem generation n, meanwhile global and s2 generations is n+1. > -- > Konstantin Osipov, Moscow, Russia