Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v2 00/11] sql: remove Triggers to server
@ 2018-06-09  9:58 Kirill Shcherbatov
  2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 10/11] sql: move " Kirill Shcherbatov
                   ` (10 more replies)
  0 siblings, 11 replies; 28+ messages in thread
From: Kirill Shcherbatov @ 2018-06-09  9:58 UTC (permalink / raw)
  To: tarantool-patches; +Cc: v.shpilevoy, Kirill Shcherbatov

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

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.


Kirill Shcherbatov (11):
  box: remove migration from alpha 1.8.2 and 1.8.4
  box: move db->pShchema init to sql_init
  sql: fix leak on CREATE TABLE and resolve self ref
  sql: fix sql len in tarantoolSqlite3RenameTrigger
  box: port schema_find_id to C
  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                                   | 130 +++++++-
 src/box/bootstrap.snap                             | Bin 1698 -> 1704 bytes
 src/box/errcode.h                                  |   2 +-
 src/box/lua/schema.lua                             |   6 +
 src/box/lua/upgrade.lua                            |  53 ++--
 src/box/schema.cc                                  |  54 +++-
 src/box/schema.h                                   |  23 +-
 src/box/space.c                                    |   5 +
 src/box/space.h                                    |   2 +
 src/box/sql.c                                      | 117 ++++----
 src/box/sql.h                                      |  66 ++++-
 src/box/sql/build.c                                |  22 +-
 src/box/sql/callback.c                             |   2 +-
 src/box/sql/fkey.c                                 |   2 -
 src/box/sql/insert.c                               |   6 +-
 src/box/sql/main.c                                 |  13 +-
 src/box/sql/sqliteInt.h                            |  30 +-
 src/box/sql/status.c                               |   6 +-
 src/box/sql/tokenize.c                             |  60 +++-
 src/box/sql/trigger.c                              | 312 ++++++++++----------
 src/box/sql/vdbe.c                                 |  90 ++----
 src/box/sql/vdbe.h                                 |   1 -
 src/box/sql/vdbeapi.c                              |   5 +-
 src/box/sql/vdbeaux.c                              |   9 -
 src/box/user.cc                                    |   4 +-
 test/box/migrate.result                            | 123 ++++++++
 test/box/migrate.test.lua                          |  45 +++
 test/box/migrate/1.10/00000000000000000003.snap    | Bin 0 -> 1568 bytes
 test/box/migrate/migrate.lua                       |   7 +
 test/box/misc.result                               | 326 +++++++++++----------
 test/box/misc.test.lua                             |   4 +-
 test/sql-tap/identifier_case.test.lua              |   4 +-
 test/sql-tap/trigger1.test.lua                     |  14 +-
 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                           | 260 ++++++++++++++++
 test/sql/triggers.test.lua                         |  94 ++++++
 39 files changed, 1337 insertions(+), 584 deletions(-)
 create mode 100644 test/box/migrate.result
 create mode 100644 test/box/migrate.test.lua
 create mode 100644 test/box/migrate/1.10/00000000000000000003.snap
 create mode 100644 test/box/migrate/migrate.lua
 create mode 100644 test/sql/triggers.result
 create mode 100644 test/sql/triggers.test.lua

-- 
2.7.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2018-06-28  7:33 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-09  9:58 [tarantool-patches] [PATCH v2 00/11] sql: remove Triggers to server Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 10/11] sql: move " Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-28  7:18   ` Konstantin Osipov
2018-06-28  7:33     ` Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 11/11] sql: VDBE tests for trigger existence Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 02/11] box: move db->pShchema init to sql_init Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 04/11] sql: fix sql len in tarantoolSqlite3RenameTrigger Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 06/11] sql: refactor sql_expr_compile to return AST Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 07/11] sql: move sqlite3DeleteTrigger to sql.h Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 08/11] box: sort error codes in misc.test Kirill Shcherbatov
2018-06-09  9:32 ` [tarantool-patches] [PATCH v2 09/11] sql: new _trigger space format with space_id Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-09  9:58 ` [tarantool-patches] [PATCH v2 01/11] box: remove migration from alpha 1.8.2 and 1.8.4 Kirill Shcherbatov
2018-06-09  9:58 ` [tarantool-patches] [PATCH v2 03/11] sql: fix leak on CREATE TABLE and resolve self ref Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov
2018-06-09  9:58 ` [tarantool-patches] [PATCH v2 05/11] box: port schema_find_id to C Kirill Shcherbatov
2018-06-13 18:53   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-14 16:12     ` Kirill Shcherbatov

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