From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: kyukhin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version Date: Mon, 9 Aug 2021 10:19:00 +0300 [thread overview] Message-ID: <ae9274f3f0ee8de36b8060c1236aa0d4279a5172.1628493342.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1628493342.git.imeevma@gmail.com> Version is needed to disallow creation of SQL built-in functions using _func starting with 2.9.0. Needed for #6106 --- src/box/alter.cc | 18 ++++++++++++++++++ src/box/schema.cc | 3 +++ src/box/schema.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/box/alter.cc b/src/box/alter.cc index 935790df4..217b882ba 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -4167,6 +4167,24 @@ on_replace_dd_schema(struct trigger * /* trigger */, void *event) return -1; REPLICASET_UUID = uu; say_info("cluster uuid %s", tt_uuid_str(&uu)); + } else if (strcmp(key, "version") == 0) { + if (new_tuple != NULL) { + uint32_t major, minor, patch; + if (tuple_field_u32(new_tuple, 1, &major) != 0 || + tuple_field_u32(new_tuple, 2, &minor) != 0) + tnt_raise(ClientError, ER_WRONG_DD_VERSION); + /* Version can be major.minor with no patch. */ + if (tuple_field_u32(new_tuple, 3, &patch) != 0) + patch = 0; + dd_version_id = version_id(major, minor, patch); + } else { + assert(old_tuple != NULL); + /* + * _schema:delete({'version'}) for + * example, for box.internal.bootstrap(). + */ + dd_version_id = tarantool_version_id(); + } } return 0; } diff --git a/src/box/schema.cc b/src/box/schema.cc index 963278b19..5659e15b7 100644 --- a/src/box/schema.cc +++ b/src/box/schema.cc @@ -70,6 +70,9 @@ uint32_t schema_version = 0; */ uint32_t space_cache_version = 0; +/** Persistent version of the schema, stored in _schema["version"]. */ +uint32_t dd_version_id = 0; + struct rlist on_schema_init = RLIST_HEAD_INITIALIZER(on_schema_init); struct rlist on_alter_space = RLIST_HEAD_INITIALIZER(on_alter_space); struct rlist on_alter_sequence = RLIST_HEAD_INITIALIZER(on_alter_sequence); diff --git a/src/box/schema.h b/src/box/schema.h index 25ac6f110..d3bbdd590 100644 --- a/src/box/schema.h +++ b/src/box/schema.h @@ -44,6 +44,7 @@ struct func; extern uint32_t schema_version; extern uint32_t space_cache_version; +extern uint32_t dd_version_id; /** Triggers invoked after schema initialization. */ extern struct rlist on_schema_init; -- 2.25.1
next prev parent reply other threads:[~2021-08-09 7:20 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-09 7:18 [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-09 7:18 ` [Tarantool-patches] [PATCH v2 1/6] sql: introduce sql_func_flags() Mergen Imeev via Tarantool-patches 2021-08-09 7:18 ` [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find() Mergen Imeev via Tarantool-patches 2021-08-09 7:18 ` [Tarantool-patches] [PATCH v2 3/6] sql: remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-09 7:19 ` Mergen Imeev via Tarantool-patches [this message] 2021-08-09 7:19 ` [Tarantool-patches] [PATCH v2 5/6] alter: disallow creation of SQL built-in function Mergen Imeev via Tarantool-patches 2021-08-09 7:19 ` [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization Mergen Imeev via Tarantool-patches 2021-08-10 7:14 ` [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Kirill Yukhin via Tarantool-patches 2021-08-10 12:52 ` Vitaliia Ioffe via Tarantool-patches 2021-08-10 13:12 ` Kirill Yukhin via Tarantool-patches -- strict thread matches above, loose matches on Subject: below -- 2021-08-04 12:58 Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version Mergen Imeev via Tarantool-patches 2021-08-05 22:17 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:47 ` Mergen Imeev via Tarantool-patches
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=ae9274f3f0ee8de36b8060c1236aa0d4279a5172.1628493342.git.imeevma@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=kyukhin@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version' \ /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