[tarantool-patches] Re: [PATCH 4/4] sql: replace pgnoRoot with struct space in BtCursor

n.pettik korablev at tarantool.org
Tue Mar 20 15:28:36 MSK 2018


> On 20 Mar 2018, at 13:58, Kirill Yukhin <kyukhin at tarantool.org> wrote:
> 
> 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.

Fixed on branch (it is obviously tragic accident).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180320/ce80e3d2/attachment.html>


More information about the Tarantool-patches mailing list