From: Kirill Yukhin <kyukhin@tarantool.org> To: tarantool-patches@freelists.org Cc: Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] Re: [PATCH 2/4] sql: rework OP_Clear internals Date: Tue, 20 Mar 2018 13:54:53 +0300 [thread overview] Message-ID: <20180320105452.2oln3bfvc4uhkuhg@tarantool.org> (raw) In-Reply-To: <48d971ed5d65bb116a6b6719cbf5f13b6328b136.1521479592.git.korablev@tarantool.org> 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? > +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. > @@ -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. -- Kirill
next prev parent reply other threads:[~2018-03-20 10:54 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 ` Kirill Yukhin [this message] 2018-03-20 12:27 ` [tarantool-patches] " n.pettik 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=20180320105452.2oln3bfvc4uhkuhg@tarantool.org \ --to=kyukhin@tarantool.org \ --cc=korablev@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