From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8743623E65 for ; Mon, 14 May 2018 14:25:48 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hvko6XtHcTRv for ; Mon, 14 May 2018 14:25:48 -0400 (EDT) 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 turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4416923E4F for ; Mon, 14 May 2018 14:25:48 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 09/12] vinyl: consolidate skip optimization checks in read iterator References: <5ff19cf39854cc565022683b6dce48aeda904d2f.1523820298.git.vdavydov.dev@gmail.com> From: Vladislav Shpilevoy Message-ID: Date: Mon, 14 May 2018 21:25:45 +0300 MIME-Version: 1.0 In-Reply-To: <5ff19cf39854cc565022683b6dce48aeda904d2f.1523820298.git.vdavydov.dev@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, kostja@tarantool.org Hello. I see several unsettling problems here. 1. Old skip functions had returned their last_stmt (itr->last_stmt), that updates their current statement (itr->curr_stmt). This was done if an iterator is not 'behind' according to the new terminology. But now if an iterator is behind, it does nothing and does not update itr->curr_stmt as well. 2. Old vy_cache_iterator_skip in the non-behind state could set 'stop' flag triggering skipped_src propagation, but now if cache is not behind, stop flag is always false, and skipped_src is not propagated. 3. vy_read_iterator_scan_txw does not use vy_read_src_is_behind() - it continues old way usage: if (!src->is_started) vy_txw_iterator_skip(src_itr, itr->last_stmt, &src->stmt); On 15/04/2018 22:55, Vladimir Davydov wrote: > Each kind of source iterator has 'skip' method, which is called to > position the iterator to a specified key. It is used to advance > sources that were skipped on the previous iteration (e.g. because > the result was found in the cache). The method has an optimization: > it avoids a lookup in the index if it is already positioned at a > statement following the specified key. This optimization makes the > method difficult to use if we want to keep a key history in each > source instead of a single statement, as we don't know whether 'skip' > changed the position or not and hence whether we need to rebuild key > history or not. Let's move the optimization to the read iterator and > make 'skip' plain and simple: let it always reposition the iterator > to the first statement following a given key. > --- > src/box/vy_cache.c | 19 ------------------- > src/box/vy_mem.c | 14 -------------- > src/box/vy_read_iterator.c | 23 ++++++++++++++++++++--- > src/box/vy_run.c | 13 ------------- > src/box/vy_tx.c | 14 -------------- > 5 files changed, 20 insertions(+), 63 deletions(-) >