From: Alexander Turenko <alexander.turenko@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: Alexander Turenko <alexander.turenko@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH] net.box: fix 'unique' index flag in net.box schema Date: Mon, 1 Apr 2019 08:08:58 +0300 [thread overview] Message-ID: <a47e7685ffd74e3e9049ed62e38fa60370b8e5f9.1554095230.git.alexander.turenko@tarantool.org> (raw) Before this commit it always returns false. Fixes #4091. --- https://github.com/tarantool/tarantool/issues/4091 https://github.com/tarantool/tarantool/tree/Totktonada/gh-4091-net.box-indexes-are-always-non-unique src/box/lua/net_box.lua | 2 +- ...box-indexes-are-always-non-unique.test.lua | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index b3139a3f5..e1c4b652b 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -1253,7 +1253,7 @@ function remote_methods:_install_schema(schema_version, spaces, indices) } idx.parts[k] = pk end - idx.unique = not not index[OPTS].is_unique + idx.unique = not not index[OPTS].unique end if sl[idx.space] ~= nil then diff --git a/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua b/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua new file mode 100755 index 000000000..04c576915 --- /dev/null +++ b/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua @@ -0,0 +1,30 @@ +#!/usr/bin/env tarantool + +local tap = require('tap') +local net_box = require('net.box') +local urilib = require('uri') + +box.cfg({ + listen = os.getenv('LISTEN') or 'localhost:3301', +}) + +box.schema.user.grant('guest', 'read,write,execute', 'universe') + +box.schema.create_space('s') +box.space.s:create_index('pk') +box.space.s:create_index('sk', {unique = false}) + +local test = tap.test('gh-4091-net.box-indexes-are-always-non-unique') +test:plan(2) + +local uri = urilib.parse(box.cfg.listen) +local uri = ('%s:%s'):format(uri.host or 'localhost', uri.service) +local conn = net_box.connect(uri) + +test:is(conn.space.s.index.pk.unique, true, 'unique index') +test:is(conn.space.s.index.sk.unique, false, 'non-unique index') + +box.space.s:drop() +box.schema.user.revoke('guest', 'read,write,execute', 'universe') + +os.exit(test:check() == true and 0 or 1) -- 2.20.1
next reply other threads:[~2019-04-01 5:09 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-01 5:08 Alexander Turenko [this message] 2019-04-01 8:42 ` [tarantool-patches] " Vladislav Shpilevoy 2019-04-01 10:08 ` Alexander Turenko 2019-04-01 15:32 ` Vladislav Shpilevoy 2019-04-01 16:15 ` Alexander Turenko 2019-04-01 17:51 ` Vladislav Shpilevoy 2019-04-12 16:22 ` Kirill Yukhin
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=a47e7685ffd74e3e9049ed62e38fa60370b8e5f9.1554095230.git.alexander.turenko@tarantool.org \ --to=alexander.turenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH] net.box: fix '\''unique'\'' index flag in net.box schema' \ /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