From: Kirill Yukhin <kyukhin@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 0/5] Move FK constraints to server
Date: Tue, 7 Aug 2018 17:57:35 +0300 [thread overview]
Message-ID: <20180807145735.weqsl2wm2lsup3cp@tarantool.org> (raw)
In-Reply-To: <cover.1531443603.git.korablev@tarantool.org>
Hello,
On 13 июл 05:04, Nikita Pettik wrote:
> Branch: https://github.com/tarantool/tarantool/commits/np/move-fk-to-server
> Issue: https://github.com/tarantool/tarantool/issues/3271
>
> The aim of this patch-set is to move foreign key constraint to server
> and them be closer to ANSI specification.
>
> First patch is preliminary and enables additional restrictions
> for FK constraints (ban opportunity to drop space referenced space,
> create FK referencing VIEW etc).
>
> In original SQLite FK constraints may appear only during CREATE TABLE
> statement. Thus, it was enough to hold string of CREATE TABLE statement
> and reparse it once on instance loading. This approach defers all
> resolutions until FK usage. For instance:
>
> CREATE TABLE t1(id PRIMARY KEY REFERENCES t2);
> CREATE TABLE t2(id PRIMARY KEY);
>
> We decided to use another approach - where FK constraints are always consistent
> and all DD links are kept up. For instance, if we attempted to satisfy all
> restrictions using SQLite schema - we wouldn't be able to create circular
> dependencies. To support circular dependecies, we must allow to create them
> after space itself. In turn, to create FK constraints outside CREATE STATEMENT,
> we must persist them. To implement these steps, firstly _fk_constraint system
> space is added - it contains tuples describing FK. Then, separate SQL statement
> <ALTER TABLE name ADD CONSTRAINT ...> is introduced which processes insertion
> and deletion from this space. Finally, FK processing has been refactored to
> rely on new DD in server (struct fkey and struct fkey_def). It seems that
> perfomance of FK handling has become a little bit better: now we don't need
> find suitable index on each FK invocation - its id is held into FK struct
> itself.
>
> The last patch is simple follow-up which removes obsolete define guard
> for FK constraints.
>
> Nikita Pettik (5):
> sql: prohibit creation of FK on unexisting tables
> schema: add new system space for FK constraints
> sql: introduce ADD CONSTRAINT statement
> sql: display error on FK creation and drop failure
> sql: remove SQLITE_OMIT_FOREIGN_KEY define guard
I've checked the whole patchset into 2.0 branch.
--
Regards, Kirill Yukhin
prev parent reply other threads:[~2018-08-07 14:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 2:04 [tarantool-patches] " Nikita Pettik
2018-07-13 2:04 ` [tarantool-patches] [PATCH 1/5] sql: prohibit creation of FK on unexisting tables Nikita Pettik
2018-07-17 21:05 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-25 10:03 ` n.pettik
2018-07-26 20:12 ` Vladislav Shpilevoy
2018-08-01 20:54 ` n.pettik
2018-08-02 22:15 ` Vladislav Shpilevoy
2018-08-06 0:27 ` n.pettik
2018-07-13 2:04 ` [tarantool-patches] [PATCH 2/5] schema: add new system space for FK constraints Nikita Pettik
2018-07-17 21:05 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-25 10:03 ` n.pettik
2018-07-26 20:12 ` Vladislav Shpilevoy
2018-08-01 20:54 ` n.pettik
2018-08-02 22:15 ` Vladislav Shpilevoy
2018-08-06 0:28 ` n.pettik
2018-08-06 18:24 ` Vladislav Shpilevoy
2018-07-13 2:04 ` [tarantool-patches] [PATCH 3/5] sql: introduce ADD CONSTRAINT statement Nikita Pettik
2018-07-17 21:05 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-25 10:03 ` n.pettik
2018-07-26 20:12 ` Vladislav Shpilevoy
2018-08-01 20:54 ` n.pettik
2018-08-02 22:15 ` Vladislav Shpilevoy
2018-08-06 0:28 ` n.pettik
2018-08-06 18:24 ` Vladislav Shpilevoy
2018-08-06 23:43 ` n.pettik
2018-07-13 2:04 ` [tarantool-patches] [PATCH 4/5] sql: display error on FK creation and drop failure Nikita Pettik
2018-07-17 21:04 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-25 10:03 ` n.pettik
2018-07-26 20:11 ` Vladislav Shpilevoy
2018-07-13 2:04 ` [tarantool-patches] [PATCH 5/5] sql: remove SQLITE_OMIT_FOREIGN_KEY define guard Nikita Pettik
2018-07-17 21:04 ` [tarantool-patches] Re: [PATCH 0/5] Move FK constraints to server Vladislav Shpilevoy
2018-08-07 14:57 ` Kirill Yukhin [this message]
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=20180807145735.weqsl2wm2lsup3cp@tarantool.org \
--to=kyukhin@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='[tarantool-patches] Re: [PATCH 0/5] Move FK constraints 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