From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id E126C6EC40; Mon, 9 Aug 2021 10:20:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E126C6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628493660; bh=sD3EkfrPeF8RijiiZOypLe7fdznv8Rb6JrHOs5IxzsU=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xjlzZUBpOfK5+lWvgnrD2dw7Hpod1at/wThnV1B3Y6VxdlItcrEZj1Mz8RMSCbXq/ 8AVm6VE3b36FLliyIDdKP3fliK057QFAHVAnUqVE88QsjYE4JZ9f/BmqzS87VX+IpZ GE0+WmtAPZJzLLPOox+NYxaV32SX6W0MLuRMdoUo= Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (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 E40666EC40 for ; Mon, 9 Aug 2021 10:19:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E40666EC40 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1mCzYq-00030n-Uc; Mon, 09 Aug 2021 10:19:01 +0300 To: kyukhin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Mon, 9 Aug 2021 10:19:00 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F6525B29142351271182A05F5380850402BC098FEF067E21CE95554AEE3AF38604837DF3669EFD34B7141F84CA67D3C81 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73976E0D379FFC3F8EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637352A1F9739ED04D38638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D80347198CDAAE2B6D747DF6B21FD19E78117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEB1593CA6EC85F86DCEDA8D6C8C3B0531D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3FA486DC37A503D0BBA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE798228CBAD4AC77F6731C566533BA786AA5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505D8E9F0B02E82798D0984C16A632750BE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C72045CD04223AD1557775D1073C125E74864F6F14672B61D9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF5218A6880B2A9D02699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FACF503ACC83041B84DA46FA44A4BC78724404A0B74BD19E4E1BD3DD2710272103AA83E7D9C78C2D1D7E09C32AA3244C8576B36BACBA20668A3565C26BBD20F9A8CE788DE6831205729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojMTMPlNJj3SgOrEptbGLPhw== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED1ADB8F870EB08F27E95554AEE3AF386021401CF93FD6FA555105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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