Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org, Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v4 0/6] sql: remove Triggers to server
Date: Wed, 20 Jun 2018 13:46:10 +0300	[thread overview]
Message-ID: <cover.1529490955.git.kshcherbatov@tarantool.org> (raw)

To move Triggers to server, we introduced special field sql_triggers 
in space struct. All triggers AST objects are stored in global Hash
db->pSchema->trigHash. Space refer to trigger AST by pointer, but not hold it.
All trigger actions operated with on_replace_dd_trigger that compiles
AST, makes all related checks(e.g. that other _trigger tuple fields
match extracred values), and does insertion in Hash and List in space.

To support LUA deletions we have changed _trigger space format to contain
space_id as secondary key: on space delete in LUA code we obtain relative 
_trigger tuples and pop up them from their space. This cause triggering
on_replace_dd_trigger that removes them from the sql_triggers list in space
and Cache, so on final space_delete no SQL trigger should be present in DB.

Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-3273-no-sql-triggers
Issue: https://github.com/tarantool/tarantool/issues/3273

Kirill Shcherbatov (6):
  sql: refactor sql_expr_compile to return AST
  sql: move sqlite3DeleteTrigger to sql.h
  box: sort error codes in misc.test
  sql: new  _trigger space format with space_id
  sql: move Triggers to server
  sql: VDBE tests for trigger existence

 src/box/alter.cc                                   | 145 ++++++++-
 src/box/bootstrap.snap                             | Bin 1698 -> 1704 bytes
 src/box/errcode.h                                  |   2 +-
 src/box/lua/schema.lua                             |   4 +
 src/box/lua/upgrade.lua                            |   4 +
 src/box/schema_def.h                               |   7 +
 src/box/space.c                                    |   5 +
 src/box/space.h                                    |   2 +
 src/box/sql.c                                      |  66 ++---
 src/box/sql.h                                      |  68 ++++-
 src/box/sql/build.c                                |  50 +++-
 src/box/sql/callback.c                             |   7 +-
 src/box/sql/fkey.c                                 |   2 -
 src/box/sql/insert.c                               |   6 +-
 src/box/sql/main.c                                 |  11 +-
 src/box/sql/prepare.c                              |  13 +
 src/box/sql/sqliteInt.h                            |  40 ++-
 src/box/sql/status.c                               |   6 +-
 src/box/sql/tokenize.c                             |  64 +++-
 src/box/sql/trigger.c                              | 326 +++++++++++----------
 src/box/sql/vdbe.c                                 | 100 ++-----
 src/box/sql/vdbe.h                                 |   1 -
 src/box/sql/vdbeaux.c                              |   9 -
 test/app-tap/tarantoolctl.test.lua                 |   2 +-
 test/box-py/bootstrap.result                       |   5 +-
 test/box/access_misc.result                        |   4 +-
 test/box/access_sysview.result                     |   4 +-
 test/box/alter.result                              |   1 +
 test/box/misc.result                               | 326 +++++++++++----------
 test/box/misc.test.lua                             |   4 +-
 test/engine/iterator.result                        |   2 +-
 test/sql-tap/identifier_case.test.lua              |   4 +-
 test/sql-tap/trigger1.test.lua                     |  14 +-
 test/sql-tap/view.test.lua                         |   8 +-
 test/sql/errinj.result                             |  45 +++
 test/sql/errinj.test.lua                           |  16 +
 test/sql/gh2141-delete-trigger-drop-table.result   |   4 +-
 test/sql/gh2141-delete-trigger-drop-table.test.lua |   4 +-
 test/sql/persistency.result                        |   8 +-
 test/sql/persistency.test.lua                      |   8 +-
 test/sql/triggers.result                           | 196 +++++++++++++
 test/sql/triggers.test.lua                         |  74 +++++
 test/sql/upgrade.result                            |  41 ++-
 test/sql/upgrade.test.lua                          |  10 +-
 test/sql/view.result                               |   4 +-
 45 files changed, 1170 insertions(+), 552 deletions(-)
 create mode 100644 test/sql/triggers.result
 create mode 100644 test/sql/triggers.test.lua

-- 
2.7.4

             reply	other threads:[~2018-06-20 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 10:46 Kirill Shcherbatov [this message]
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 1/6] sql: refactor sql_expr_compile to return AST Kirill Shcherbatov
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 2/6] sql: move sqlite3DeleteTrigger to sql.h Kirill Shcherbatov
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 3/6] box: sort error codes in misc.test Kirill Shcherbatov
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 4/6] sql: new _trigger space format with space_id Kirill Shcherbatov
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 5/6] sql: move Triggers to server Kirill Shcherbatov
2018-06-24 15:24   ` [tarantool-patches] " n.pettik
2018-06-24 20:41     ` Vladislav Shpilevoy
2018-06-25 15:27     ` Kirill Shcherbatov
2018-06-26 14:05       ` n.pettik
2018-06-26 16:13         ` Kirill Shcherbatov
2018-06-20 10:46 ` [tarantool-patches] [PATCH v4 6/6] sql: VDBE tests for trigger existence Kirill Shcherbatov
2018-06-24 15:25   ` [tarantool-patches] " n.pettik
2018-06-25 15:27     ` Kirill Shcherbatov
2018-06-26 14:49       ` 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.1529490955.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v4 0/6] sql: remove Triggers to server' \
    /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