From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 880EA43D678 for ; Mon, 14 Oct 2019 19:03:26 +0300 (MSK) From: Kirill Shcherbatov Date: Mon, 14 Oct 2019 19:03:15 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v1 0/9] schema: rework _trigger space List-Id: Tarantool development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org, kostja.osipov@gmail.com, korablev@tarantool.org This patchset reworks structures that represent SQL triggers to inherent them from base trigger class. It is an important step to introduce a LUA persistent trigger in Tarantool as well as to support SQL triggers evaluation on the server side. In scope of this patchset the _triggers space was extended with a new fields. The _trigger space updated format is: [ STRING, UINT32, MAP, STR, STR, STR, STR, STR] Now trigger is produced mostly by tuple-based metadata definition instead of naive SQL request parsing. Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4343-persistent-triggers Issue: https://github.com/tarantool/tarantool/issues/4343 Kirill Shcherbatov (9): sql: remove redundant pointer in TriggerStep box: rename struct trigger to lua_trigger box: introduce trigger_event_manipulation enum box: introduce trigger_action_timing enum sql: use rlist to organize triggers in a list sql: rework CREATE TABLE rule in parser sql: wrap all ASTs in sql_trigger_expr structure sql: inherit sql_trigger from a new trigger class schema: rework _trigger system space src/box/CMakeLists.txt | 2 + src/box/alter.cc | 438 +++++++++-------- src/box/alter.h | 34 +- src/box/applier.cc | 28 +- src/box/applier.h | 2 +- src/box/bootstrap.snap | Bin 5934 -> 5981 bytes src/box/ck_constraint.c | 2 +- src/box/ck_constraint.h | 4 +- src/box/errcode.h | 1 + src/box/error.cc | 2 +- src/box/fk_constraint.c | 6 +- src/box/iproto.cc | 4 +- src/box/lua/call.c | 4 +- src/box/lua/sequence.c | 4 +- src/box/lua/space.cc | 4 +- src/box/lua/tuple.c | 2 +- src/box/lua/upgrade.lua | 16 + src/box/memtx_space.c | 8 +- src/box/recovery.cc | 2 +- src/box/relay.cc | 6 +- src/box/replication.cc | 8 +- src/box/replication.h | 4 +- src/box/schema.cc | 2 +- src/box/schema_def.h | 5 + src/box/session.cc | 4 +- src/box/session.h | 4 +- src/box/space.c | 11 +- src/box/space.h | 4 +- src/box/sql.c | 105 ++-- src/box/sql.h | 125 +++-- src/box/sql/build.c | 97 +++- src/box/sql/delete.c | 27 +- src/box/sql/fk_constraint.c | 109 +++-- src/box/sql/insert.c | 42 +- src/box/sql/parse.y | 26 +- src/box/sql/parse_def.h | 29 +- src/box/sql/prepare.c | 7 +- src/box/sql/resolve.c | 15 +- src/box/sql/sqlInt.h | 111 ++--- src/box/sql/tokenize.c | 16 +- src/box/sql/trigger.c | 448 ++++++------------ src/box/sql/update.c | 45 +- src/box/sql/vdbe.c | 18 +- src/box/trigger.c | 73 +++ src/box/trigger.h | 80 ++++ src/box/trigger_def.c | 131 +++++ src/box/trigger_def.h | 194 ++++++++ src/box/txn.c | 8 +- src/box/txn.h | 14 +- src/box/vinyl.c | 32 +- src/box/vy_lsm.c | 2 +- src/box/vy_scheduler.c | 4 +- src/box/vy_tx.c | 2 +- src/lib/core/cbus.c | 2 +- src/lib/core/fiber.c | 6 +- src/lib/core/trigger.cc | 6 +- src/lib/core/trigger.h | 20 +- src/lib/swim/swim.c | 2 +- src/lua/swim.c | 2 +- src/lua/trigger.c | 6 +- src/lua/trigger.h | 2 +- src/lua/utils.h | 2 +- src/main.cc | 4 +- test/box-py/bootstrap.result | 5 +- test/box/access_misc.result | 139 +++--- test/box/misc.result | 1 + test/sql/ddl.result | 6 +- test/sql/ddl.test.lua | 6 +- .../gh2141-delete-trigger-drop-table.result | 36 +- .../gh2141-delete-trigger-drop-table.test.lua | 4 +- test/sql/persistency.result | 36 +- test/sql/persistency.test.lua | 8 +- test/sql/triggers.result | 91 ++-- test/sql/triggers.test.lua | 30 +- test/sql/upgrade.result | 16 +- test/sql/upgrade.test.lua | 4 +- test/unit/CMakeLists.txt | 3 +- test/unit/cbus.c | 6 +- test/unit/swim.c | 14 +- test/unit/swim_test_utils.c | 6 +- 80 files changed, 1695 insertions(+), 1139 deletions(-) create mode 100644 src/box/trigger.c create mode 100644 src/box/trigger.h create mode 100644 src/box/trigger_def.c create mode 100644 src/box/trigger_def.h -- 2.23.0