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 C51A823009 for ; Tue, 20 Mar 2018 06:58:44 -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 En-jYPpzyVOa for ; Tue, 20 Mar 2018 06:58:44 -0400 (EDT) Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 82F0E208FB for ; Tue, 20 Mar 2018 06:58:44 -0400 (EDT) Date: Tue, 20 Mar 2018 13:58:41 +0300 From: Kirill Yukhin Subject: [tarantool-patches] Re: [PATCH 4/4] sql: replace pgnoRoot with struct space in BtCursor Message-ID: <20180320105840.izfy5rpnz32fx6hj@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Cc: Nikita Pettik Hello, Single comment. On 19 мар 21:10, Nikita Pettik wrote: > Instead of passing encoded space id and index id to SQL bindings, > pointers to space and index are saved in cursor and passed implicitly. > Space and index lookups appear during execution of > OP_OpenRead/OP_OpenWrite once. Moreover, having struct space it has > become possible to remove several wrapper-function calls on insertions > and deletions by invoking sql_execute_dml(). > > Closes #3122 > --- > src/box/sql.c | 87 +++++++++++++++++++++++----------------------- > src/box/sql/cursor.h | 3 +- > src/box/sql/tarantoolInt.h | 2 +- > src/box/sql/vdbe.c | 24 ++++++------- > src/box/sql/vdbeInt.h | 1 - > 5 files changed, 58 insertions(+), 59 deletions(-) > > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > index cd3321c4f..1ee8c4d7b 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -3209,16 +3214,17 @@ case OP_OpenWrite: > pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_TARANTOOL); > if (pCur==0) goto no_mem; > pCur->nullRow = 1; > - pCur->pgnoRoot = p2; > > assert(p2 >= 1); > pBtCur = pCur->uc.pCursor; > - pBtCur->pgnoRoot = p2; > + pBtCur->space = space_by_id(SQLITE_PAGENO_TO_SPACEID(p2)); > + pBtCur->index = space_index(pBtCur->space, SQLITE_PAGENO_TO_INDEXID(p2)); > + assert(pBtCur->space != NULL && pBtCur->index != NULL); > pBtCur->eState = CURSOR_INVALID; > pBtCur->curFlags |= BTCF_TaCursor; > pCur->pKeyInfo = pKeyInfo; > > - open_cursor_set_hints: > +// open_cursor_set_hints: Please, don't usse C++ style comments. -- Thanks, Kirill