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 1327E2B12C for ; Tue, 20 Mar 2018 08:28:39 -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 Fb0jkKNIvM6M for ; Tue, 20 Mar 2018 08:28:38 -0400 (EDT) Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 9EFCC2B088 for ; Tue, 20 Mar 2018 08:28:38 -0400 (EDT) From: "n.pettik" Message-Id: <216A377C-389E-4B6F-8E4D-BF8ED80F5633@tarantool.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_7A8076F2-75D3-4447-95F9-414E5C21599B" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 4/4] sql: replace pgnoRoot with struct space in BtCursor Date: Tue, 20 Mar 2018 15:28:36 +0300 In-Reply-To: <20180320105840.izfy5rpnz32fx6hj@tarantool.org> References: <20180320105840.izfy5rpnz32fx6hj@tarantool.org> 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: Kirill Yukhin Cc: tarantool-patches@freelists.org --Apple-Mail=_7A8076F2-75D3-4447-95F9-414E5C21599B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 20 Mar 2018, at 13:58, Kirill Yukhin wrote: >=20 > Hello, >=20 > Single comment. >=20 > On 19 =D0=BC=D0=B0=D1=80 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(). >>=20 >> 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(-) >>=20 >> 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 =3D allocateCursor(p, pOp->p1, nField, CURTYPE_TARANTOOL); >> if (pCur=3D=3D0) goto no_mem; >> pCur->nullRow =3D 1; >> - pCur->pgnoRoot =3D p2; >>=20 >> assert(p2 >=3D 1); >> pBtCur =3D pCur->uc.pCursor; >> - pBtCur->pgnoRoot =3D p2; >> + pBtCur->space =3D space_by_id(SQLITE_PAGENO_TO_SPACEID(p2)); >> + pBtCur->index =3D space_index(pBtCur->space, = SQLITE_PAGENO_TO_INDEXID(p2)); >> + assert(pBtCur->space !=3D NULL && pBtCur->index !=3D NULL); >> pBtCur->eState =3D CURSOR_INVALID; >> pBtCur->curFlags |=3D BTCF_TaCursor; >> pCur->pKeyInfo =3D pKeyInfo; >>=20 >> - open_cursor_set_hints: >> +// open_cursor_set_hints: > Please, don't usse C++ style comments. Fixed on branch (it is obviously tragic accident). --Apple-Mail=_7A8076F2-75D3-4447-95F9-414E5C21599B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On 20 Mar 2018, at 13:58, Kirill Yukhin <kyukhin@tarantool.org> wrote:

Hello,
Single comment.

On 19 =D0=BC=D0=B0=D1=80 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 =             &n= bsp;| 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 =3D allocateCursor(p, = pOp->p1, nField, CURTYPE_TARANTOOL);
if = (pCur=3D=3D0) goto no_mem;
pCur->nullRow =3D 1;
- = pCur->pgnoRoot =3D p2;

assert(p2 = >=3D 1);
pBtCur =3D = pCur->uc.pCursor;
- pBtCur->pgnoRoot =3D p2;
+ = pBtCur->space =3D = space_by_id(SQLITE_PAGENO_TO_SPACEID(p2));
+ = pBtCur->index =3D space_index(pBtCur->space, = SQLITE_PAGENO_TO_INDEXID(p2));
+ = assert(pBtCur->space !=3D NULL && pBtCur->index !=3D = NULL);
pBtCur->eState =3D CURSOR_INVALID;
= pBtCur->curFlags |=3D BTCF_TaCursor;
= pCur->pKeyInfo =3D pKeyInfo;

- = open_cursor_set_hints:
+// = open_cursor_set_hints:
Please, don't usse C++ style = comments.

Fixed on branch (it is obviously tragic = accident).

= --Apple-Mail=_7A8076F2-75D3-4447-95F9-414E5C21599B--