Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, korablev@tarantool.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v2 0/9] sql: Checks on server side
Date: Wed, 30 Jan 2019 11:59:07 +0300	[thread overview]
Message-ID: <cover.1548838034.git.kshcherbatov@tarantool.org> (raw)

Fire check constraints for LUA space for insert and update operations

1. Reworked check constraints in Tarantool - refactored code:
 -- new _ck_constraint space to persist check constraints
 -- new ck_constrain_def and ck_constraint classes to work with ck constraints
 -- checks based on TYPEOF operator are forbidden

2. Fixed few bugs in core (out of Checks epic)
 -- access check for _treigger and _ck_constraint space
 -- fixed 2.1.1 migration
 -- fixed possible segfault and _trigger space alter

Changes in version 2:
 -- Totally changed approach to store check constraints in server
 -- Independent VDBE on server for each check constraint:
    (pay attantion that we must recompile VDBE on space alter operation
     as space_def may be changed)
 -- routines is split by modules in a better way

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

Kirill Shcherbatov (9):
  box: fix upgrade script for _fk_constraint space
  box: fix _trigger and _ck_constraint access check
  box: fix Tarantool upgrade from 2.1.0 to 2.1.1
  box: fix on_replace_trigger_rollback routine
  schema: add new system space for CHECK constraints
  sql: disallow use of TYPEOF in Check
  sql: refactor sqlite3_reset routine
  box: exported sql_bind structure and API
  sql: run check constraint tests on space alter

 src/box/CMakeLists.txt                        |   2 +
 src/box/alter.cc                              | 256 +++++++++++++-
 src/box/alter.h                               |   1 +
 src/box/bind.c                                | 239 +++++++++++++
 src/box/bind.h                                | 138 ++++++++
 src/box/bootstrap.snap                        | Bin 1911 -> 1955 bytes
 src/box/ck_constraint.c                       | 318 ++++++++++++++++++
 src/box/ck_constraint.h                       | 187 ++++++++++
 src/box/errcode.h                             |   4 +-
 src/box/execute.c                             | 270 +--------------
 src/box/execute.h                             |  18 +-
 src/box/index_def.c                           |   1 +
 src/box/iproto.cc                             |   1 +
 src/box/lua/schema.lua                        |   4 +
 src/box/lua/space.cc                          |   2 +
 src/box/lua/upgrade.lua                       |  64 +++-
 src/box/opt_def.c                             |   3 +
 src/box/opt_def.h                             |  12 +-
 src/box/schema.cc                             |   8 +
 src/box/schema_def.h                          |   9 +
 src/box/space.c                               |   2 +
 src/box/space.h                               |   5 +
 src/box/space_def.c                           |  97 +-----
 src/box/space_def.h                           |   2 -
 src/box/sql.c                                 |  99 +-----
 src/box/sql.h                                 |  44 ---
 src/box/sql/build.c                           | 160 +++++++--
 src/box/sql/insert.c                          | 111 ++----
 src/box/sql/parse.y                           |   4 +-
 src/box/sql/prepare.c                         |   1 +
 src/box/sql/resolve.c                         |   3 +
 src/box/sql/select.c                          |   3 +-
 src/box/sql/sqliteInt.h                       |  42 ++-
 src/box/sql/vdbe.c                            |   8 +-
 src/box/sql/vdbeapi.c                         |  58 +---
 test/app-tap/tarantoolctl.test.lua            |   4 +-
 test/box-py/bootstrap.result                  |   6 +-
 test/box/access.result                        |   3 +
 test/box/access.test.lua                      |   1 +
 test/box/access_misc.result                   |   2 +
 test/box/access_sysview.result                |   6 +-
 test/box/alter.result                         |   6 +-
 test/box/misc.result                          |   2 +
 test/sql-tap/check.test.lua                   |  94 ++----
 test/sql-tap/fkey2.test.lua                   |   4 +-
 test/sql-tap/in1.test.lua                     |   2 +-
 test/sql-tap/subquery.test.lua                |   2 +-
 test/sql-tap/table.test.lua                   |   8 +-
 test/sql/checks.result                        | 112 +++---
 test/sql/checks.test.lua                      |  60 ++--
 test/sql/errinj.result                        |  76 +++++
 test/sql/errinj.test.lua                      |  26 ++
 test/sql/gh-2981-check-autoinc.result         |   8 +-
 test/sql/upgrade.result                       |  51 +++
 test/sql/upgrade.test.lua                     |  17 +
 .../upgrade/2.1.0/00000000000000000003.snap   | Bin 0 -> 2124 bytes
 test/wal_off/alter.result                     |   2 +-
 57 files changed, 1792 insertions(+), 876 deletions(-)
 create mode 100644 src/box/bind.c
 create mode 100644 src/box/bind.h
 create mode 100644 src/box/ck_constraint.c
 create mode 100644 src/box/ck_constraint.h
 create mode 100644 test/sql/upgrade/2.1.0/00000000000000000003.snap

-- 
2.19.2

             reply	other threads:[~2019-01-30  8:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30  8:59 Kirill Shcherbatov [this message]
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 1/9] box: fix upgrade script for _fk_constraint space Kirill Shcherbatov
2019-03-11 18:44   ` [tarantool-patches] " n.pettik
2019-03-13 11:36   ` Kirill Yukhin
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 2/9] box: fix _trigger and _ck_constraint access check Kirill Shcherbatov
2019-03-11 19:29   ` [tarantool-patches] " n.pettik
2019-03-22  9:29     ` Vladislav Shpilevoy
2019-03-26 10:59     ` Kirill Shcherbatov
2019-04-01 14:06       ` n.pettik
2019-03-13 11:38   ` Kirill Yukhin
2019-03-13 11:44     ` Kirill Yukhin
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 3/9] box: fix Tarantool upgrade from 2.1.0 to 2.1.1 Kirill Shcherbatov
2019-03-12 11:45   ` [tarantool-patches] " n.pettik
2019-03-20 15:12     ` n.pettik
2019-03-20 15:38       ` Kirill Shcherbatov
2019-03-21 15:23         ` n.pettik
2019-03-21 15:36           ` Vladislav Shpilevoy
2019-03-22  9:28         ` Vladislav Shpilevoy
2019-03-22 10:18           ` Kirill Shcherbatov
2019-03-22 10:21             ` Vladislav Shpilevoy
2019-03-26  9:52   ` Kirill Yukhin
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 4/9] box: fix on_replace_trigger_rollback routine Kirill Shcherbatov
2019-03-11 20:00   ` [tarantool-patches] " n.pettik
2019-03-13 11:39   ` Kirill Yukhin
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 5/9] schema: add new system space for CHECK constraints Kirill Shcherbatov
2019-03-22  9:29   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-22  9:52     ` n.pettik
2019-03-26 10:59     ` Kirill Shcherbatov
2019-04-01 19:45       ` n.pettik
2019-04-16 13:51         ` Kirill Shcherbatov
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 6/9] sql: disallow use of TYPEOF in Check Kirill Shcherbatov
2019-03-26 10:59   ` [tarantool-patches] " Kirill Shcherbatov
2019-04-01 19:52     ` n.pettik
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 7/9] sql: refactor sqlite3_reset routine Kirill Shcherbatov
2019-03-26 10:59   ` [tarantool-patches] " Kirill Shcherbatov
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 8/9] box: exported sql_bind structure and API Kirill Shcherbatov
2019-03-26 10:59   ` [tarantool-patches] " Kirill Shcherbatov
2019-01-30  8:59 ` [tarantool-patches] [PATCH v2 9/9] sql: run check constraint tests on space alter Kirill Shcherbatov
2019-03-26 10:59   ` [tarantool-patches] " Kirill Shcherbatov
2019-04-02 14:14     ` n.pettik
2019-04-16 13:51       ` Kirill Shcherbatov

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.1548838034.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v2 0/9] sql: Checks on server side' \
    /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