From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.mail.ru (smtp1.mail.ru [94.100.179.111]) (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 E03D042EF5C for ; Tue, 16 Jun 2020 15:10:39 +0300 (MSK) References: <50a25fbae907f1b0d5406fb2e78d40d3e42a8a8d.1591029888.git.korablev@tarantool.org> From: Aleksandr Lyapunov Message-ID: <4a83c68d-2dfd-23a8-97cd-5a429639dc3c@tarantool.org> Date: Tue, 16 Jun 2020 15:10:38 +0300 MIME-Version: 1.0 In-Reply-To: <50a25fbae907f1b0d5406fb2e78d40d3e42a8a8d.1591029888.git.korablev@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH v2] vinyl: restart read iterator in case of rolled back WAL List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik , tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org Thanks for the patch! See my 2 comments below: On 6/1/20 7:46 PM, Nikita Pettik wrote: > > + if (vy_mem_tree_iterator_is_invalid(&src->mem_iterator.curr_pos)) { > + assert(src->mem_iterator.curr.stmt == NULL); > + return 1; > + } I'm afraid that the iterator will not always be invalid in the given case. As I see, if a mem holds any older tuple with the same key (e.g. older version of that tuple), the restoration routine will find the older tuple with the non-invalid iterator. I also think that mem_restore must handle all the possible data changes by itself without concern of read_iterator. > - if (vy_read_iterator_restore_mem(itr, &next) != 0) > + int rc = vy_read_iterator_restore_mem(itr, &next); > + if (rc < 0) > return -1; > + if (rc > 0) { > + vy_read_iterator_restore(itr); > + goto restart; > + } The read iterator was rewritten several times and still have at least several bugs. I think we should admit that we cannot support such a complicated solution. How about some stupid solution: if ANY change has been happened during yield - restart advancing?