Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: "Кирилл Юхин" <kyukhin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 2/4] sql: rework OP_Clear internals
Date: Tue, 20 Mar 2018 15:27:05 +0300	[thread overview]
Message-ID: <1712F845-FB6E-4E19-9294-160A036F69B5@tarantool.org> (raw)
In-Reply-To: <20180320105452.2oln3bfvc4uhkuhg@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 3092 bytes --]


> On 20 Mar 2018, at 13:54, Kirill Yukhin <kyukhin@tarantool.org> wrote:
> 
> Hello,
> 
> My comments are inlined.
> 
> On 19 мар 21:10, Nikita Pettik wrote:
>> This patch makes OP_Clear use pointer to space instead of space id.
>> Moreover, in order to avoid excess function calls (such as box_delete() ->
>> box_process1(), which in its turn makes additional space lookup),
>> sql_execute_dml() function is introduced. It is an analogue of
>> process_rw() from BOX internals. Its purpose is to handle transaction
>> routine and call DML executor. This function will be also used later as
>> well during insertion and deletion.
>> 
>> Part of #3122
>> ---
>> src/box/sql.c              | 54 +++++++++++++++++++++++++++++++---------------
>> src/box/sql/opcodes.c      |  2 +-
>> src/box/sql/opcodes.h      |  2 +-
>> src/box/sql/tarantoolInt.h |  2 +-
>> src/box/sql/vdbe.c         | 28 ++++++++++--------------
>> 5 files changed, 51 insertions(+), 37 deletions(-)
>> 
>> diff --git a/src/box/sql.c b/src/box/sql.c
>> index 256985793..4f8b39810 100644
>> --- a/src/box/sql.c
>> +++ b/src/box/sql.c
>> @@ -191,6 +191,27 @@ is_tarantool_error(int rc)
>> 		rc == SQL_TARANTOOL_INSERT_FAIL);
>> }
>> 
>> +/**
>> + * This function is analogue of process_rw() from box module.
>> + * Apart of calling space_execute_dml(), it handles transaction
>> + * routine.
>> + */
> Could you pls describe params as well?

As you wish, but it would look like “comments for the sake of comments”:
function is 10 lines long and I stick to the point that the purpose of 
arguments is obvious.  

> 
>> +static int
>> +sql_execute_dml(struct request *request, struct space *space)
>> +{
>> +	struct txn *txn = txn_begin_stmt(space);
>> +	if (txn == NULL)
>> +		return -1;
>> +	struct tuple *unused = NULL;
>> +	if (space_execute_dml(space, txn, request, &unused) != 0) {
>> +		txn_rollback_stmt();
>> +		return -1;
>> +	}
>> +	if (txn_commit_stmt(txn, request) != 0)
>> +		return -1;
>> +	return 0;
>> +}
> So, you've copied process_rw, removing statitics udpate and access
> checks? I think, this won't work. The only concern I see here is that
> process_rw returns a tuple, which is useless for SQL so far.

Ok, I have returned these two functions (as it happens in process_rw).
But I thought that in SQL we would have more “integrated” system
of privilege checks and separate (from box) metrics:

+	rmean_collect(rmean_box, request->type, 1);
+	if (access_check_space(space, PRIV_W) != 0)
+		return -1;

> 
>> @@ -670,30 +689,31 @@ int tarantoolSqlite3ClearTable(int iTable)
>> 			}
>> 		}
>> -		box_iterator_free(iter);
>> -	} else if (box_truncate(space_id) != 0) {
>> +		iterator_delete(iter);
>> +	} else if (box_truncate(space->def->id) != 0) {
> I think we should block box_truncate sp far: too much complications this
> DDL operation introduce. We'll re-implement it as optimization in furture.
> Also, we'll support ANSI SQL's TRUNCATE TABLE.
> 

Fixed on branch. Also, updated comments for OP_Clear.


[-- Attachment #2: Type: text/html, Size: 15087 bytes --]

  reply	other threads:[~2018-03-20 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 18:10 [tarantool-patches] [PATCH 0/4] Remove space id and index id from cursor Nikita Pettik
2018-03-19 18:10 ` [tarantool-patches] [PATCH 1/4] Move space_is_system helper from CPP define guard Nikita Pettik
2018-03-19 18:10 ` [tarantool-patches] [PATCH 2/4] sql: rework OP_Clear internals Nikita Pettik
2018-03-20 10:54   ` [tarantool-patches] " Kirill Yukhin
2018-03-20 12:27     ` n.pettik [this message]
2018-03-19 18:10 ` [tarantool-patches] [PATCH 3/4] sql: remove struct ta_cursor and refactor BtCursor Nikita Pettik
2018-03-19 18:10 ` [tarantool-patches] [PATCH 4/4] sql: replace pgnoRoot with struct space in BtCursor Nikita Pettik
2018-03-20 10:58   ` [tarantool-patches] " Kirill Yukhin
2018-03-20 12:28     ` n.pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1712F845-FB6E-4E19-9294-160A036F69B5@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 2/4] sql: rework OP_Clear internals' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox