Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH 0/4] Replace space id with space ptrs in VDBE runtime
Date: Wed, 21 Mar 2018 02:48:38 +0300	[thread overview]
Message-ID: <cover.1521583434.git.korablev@tarantool.org> (raw)

Branch: https://github.com/tarantool/tarantool/tree/np/gh-3252-slit-dml-and-ddl-sql
Issue: https://github.com/tarantool/tarantool/issues/3252

In order to avoid additional lookups during VDBE execution,
it was suggested to pass pointer fetched at query compilation time to
opcodes which create cursors (i.e. OP_OpenRead and OP_OpenWrite).
However, any DDL routine may invalidate pointers. Thus, to operate on
system spaces (which are used during DDL) new opcodes have been introduced:
OP_SInsert and OP_SDelete. But originally, SQL DDL under hood used nested
parsing to generate code for non-trivial deletion. For instance:
"DELETE FROM _INDEX WHERE id = space_id AND iid > 0" -- to remove all
secondary indexes. To use new operands such nested parsing has been
substituted with hardcoded VDBE programs.
Finally, fresh pointer to space can also be obtained at VDBE rutime using
new opcode OP_SIDtoPtr, which converts space id to ptr and saves it to
given register. This opcode should be used when it is impossible to avoid
mixing DDL and DML routine in the same query
(e.g. CREATE TABLE AS SELECT FROM ...).

Nikita Pettik (4):
  sql: pass space pointer to OP_OpenRead/OpenWrite
  sql: introduce opcodes to operate on system spaces
  sql: rework code generation for DDL routine
  sql: rework OP_OpenWrite/OpenRead

 src/box/sql.c                |  51 ++++---
 src/box/sql/analyze.c        |  17 ++-
 src/box/sql/build.c          | 321 ++++++++++++++++++++++---------------------
 src/box/sql/expr.c           |  14 +-
 src/box/sql/fkey.c           |  11 +-
 src/box/sql/insert.c         |  37 ++++-
 src/box/sql/opcodes.c        |  51 +++----
 src/box/sql/opcodes.h        |  59 ++++----
 src/box/sql/select.c         |  11 +-
 src/box/sql/sqliteInt.h      |   5 +
 src/box/sql/tarantoolInt.h   |  11 +-
 src/box/sql/trigger.c        |  27 ++--
 src/box/sql/vdbe.c           | 310 +++++++++++++++++++++--------------------
 src/box/sql/vdbe.h           |   1 +
 src/box/sql/vdbeInt.h        |   1 +
 src/box/sql/vdbeaux.c        |  13 ++
 src/box/sql/where.c          |  12 +-
 test/sql/transition.result   |  11 +-
 test/sql/transition.test.lua |   8 +-
 19 files changed, 550 insertions(+), 421 deletions(-)

-- 
2.15.1

             reply	other threads:[~2018-03-20 23:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 23:48 Nikita Pettik [this message]
2018-03-20 23:48 ` [tarantool-patches] [PATCH 1/4] sql: pass space pointer to OP_OpenRead/OpenWrite Nikita Pettik
2018-03-21 13:14   ` [tarantool-patches] " Kirill Yukhin
2018-03-22 10:07     ` n.pettik
2018-03-22 11:04       ` v.shpilevoy
2018-03-23 16:01         ` n.pettik
2018-03-20 23:48 ` [tarantool-patches] [PATCH 2/4] sql: introduce opcodes to operate on system spaces Nikita Pettik
2018-03-22 11:42   ` [tarantool-patches] " v.shpilevoy
2018-03-22 12:23     ` n.pettik
2018-03-22 13:09       ` v.shpilevoy
2018-03-23 16:20         ` n.pettik
2018-03-20 23:48 ` [tarantool-patches] [PATCH 3/4] sql: rework code generation for DDL routine Nikita Pettik
2018-03-22 13:57   ` [tarantool-patches] " v.shpilevoy
2018-03-23 16:33     ` n.pettik
2018-03-20 23:48 ` [tarantool-patches] [PATCH 4/4] sql: rework OP_OpenWrite/OpenRead Nikita Pettik
2018-03-22 14:11   ` [tarantool-patches] " v.shpilevoy
2018-03-23 16:39     ` n.pettik
2018-03-24 12:37 ` [tarantool-patches] Re: [PATCH 0/4] Replace space id with space ptrs in VDBE runtime v.shpilevoy
2018-03-27 16: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=cover.1521583434.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 0/4] Replace space id with space ptrs in VDBE runtime' \
    /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