From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, v.shpilevoy@tarantool.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v4 0/4] box: run checks on insertions in LUA spaces
Date: Thu, 16 May 2019 16:56:49 +0300 [thread overview]
Message-ID: <cover.1558014727.git.kshcherbatov@tarantool.org> (raw)
Fire CK constraints for LUA spaces.
To achieve this goal, we reworked data dictionary, to store ck
constraints in separate space _ck_constraints and updated data
migration script to migrate existent data there. This also would
be useful in future to implement ALTER SPACE ADD CONSTRAINT
operation. Now we do not support CK constraint creation on
non-empty space.
Each CK has own precompiled VDBE machine that performs this
check with tuple fields mapped to it's memory with sql_bind() api.
In case of ck constraint conflict detected by this VM we abort
the transaction and return error to user.
Finally, we introduced a LUA-wrapper that provide a user-friendly
way to manage space ck constraints.
Changes in version 4:
- language field in _ck_constraint space
- moved sql_flags context to parser and VDBE
- cool column_mask binding optimization
v2: https://www.freelists.org/post/tarantool-patches/PATCH-v2-09-sql-Checks-on-server-side
v1: https://www.freelists.org/post/tarantool-patches/PATCH-v1-04-sql-Checks-on-server-side
Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-3691-checks-on-server-side
Issue: https://github.com/tarantool/tarantool/issues/3691
Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-3691-checks-on-server-side
Issue: https://github.com/tarantool/tarantool/issues/3691
Kirill Shcherbatov (4):
schema: add new system space for CHECK constraints
box: run check constraint tests on space alter
box: introduce column_mask for ck constraint
box: user-friendly interface to manage ck constraints
src/box/CMakeLists.txt | 1 +
src/box/alter.cc | 313 ++++++++++++++-
src/box/alter.h | 1 +
src/box/bootstrap.snap | Bin 4374 -> 4428 bytes
src/box/ck_constraint.c | 313 +++++++++++++++
src/box/ck_constraint.h | 186 +++++++++
src/box/errcode.h | 4 +-
src/box/lua/schema.lua | 39 +-
src/box/lua/space.cc | 65 +++
src/box/lua/upgrade.lua | 43 ++
src/box/schema.cc | 8 +
src/box/schema_def.h | 11 +
src/box/space.c | 2 +
src/box/space.h | 5 +
src/box/space_def.c | 98 +----
src/box/space_def.h | 2 -
src/box/sql.c | 86 +---
src/box/sql.h | 41 +-
src/box/sql/build.c | 213 ++++++++--
src/box/sql/insert.c | 115 ++----
src/box/sql/parse.y | 2 +-
src/box/sql/parse_def.h | 24 ++
src/box/sql/resolve.c | 19 +-
src/box/sql/select.c | 11 +-
src/box/sql/sqlInt.h | 34 +-
src/box/sql/tokenize.c | 1 -
src/box/sql/vdbeapi.c | 8 -
test/app-tap/tarantoolctl.test.lua | 4 +-
test/box-py/bootstrap.result | 7 +-
test/box/access.result | 3 +
test/box/access.test.lua | 1 +
test/box/access_misc.result | 3 +
test/box/access_sysview.result | 6 +-
test/box/alter.result | 6 +-
test/box/misc.result | 2 +
test/sql-tap/check.test.lua | 42 +-
test/sql-tap/fkey2.test.lua | 4 +-
test/sql-tap/sql-errors.test.lua | 2 +-
test/sql-tap/table.test.lua | 12 +-
test/sql/checks.result | 547 ++++++++++++++++++++++++--
test/sql/checks.test.lua | 204 ++++++++--
test/sql/errinj.result | 140 +++++++
test/sql/errinj.test.lua | 45 +++
test/sql/gh-2981-check-autoinc.result | 12 +-
test/sql/types.result | 3 +-
test/sql/upgrade.result | 19 +
test/sql/upgrade.test.lua | 5 +
test/wal_off/alter.result | 2 +-
48 files changed, 2222 insertions(+), 492 deletions(-)
create mode 100644 src/box/ck_constraint.c
create mode 100644 src/box/ck_constraint.h
--
2.21.0
next reply other threads:[~2019-05-16 13:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 13:56 Kirill Shcherbatov [this message]
2019-05-16 13:56 ` [tarantool-patches] [PATCH v4 1/4] schema: add new system space for CHECK constraints Kirill Shcherbatov
2019-05-19 16:01 ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-23 10:32 ` Kirill Shcherbatov
2019-05-26 12:03 ` Vladislav Shpilevoy
2019-05-31 13:45 ` Kirill Shcherbatov
2019-05-16 13:56 ` [tarantool-patches] [PATCH v4 2/4] box: run check constraint tests on space alter Kirill Shcherbatov
2019-05-19 16:02 ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-23 10:37 ` Kirill Shcherbatov
2019-05-16 13:56 ` [tarantool-patches] [PATCH v4 3/4] box: introduce column_mask for ck constraint Kirill Shcherbatov
2019-05-19 16:02 ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-23 10:38 ` Kirill Shcherbatov
2019-05-26 12:03 ` Vladislav Shpilevoy
2019-05-31 13:45 ` Kirill Shcherbatov
2019-05-16 13:56 ` [tarantool-patches] [PATCH v4 4/4] box: user-friendly interface to manage ck constraints Kirill Shcherbatov
2019-05-19 16:02 ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-23 10:41 ` Kirill Shcherbatov
2019-05-26 12:04 ` Vladislav Shpilevoy
2019-05-31 13:45 ` Kirill Shcherbatov
2019-06-03 21:15 ` Vladislav Shpilevoy
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.1558014727.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [tarantool-patches] [PATCH v4 0/4] box: run checks on insertions in LUA spaces' \
/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