From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [PATCH v1 1/1] box: ban multikey index with multiple root field
Date: Thu, 23 May 2019 10:15:34 +0300 [thread overview]
Message-ID: <37db0e91be78bca289f50c77a405f1eb1dc36841.1558595664.git.kshcherbatov@tarantool.org> (raw)
The test for multikey index prefix compatibility was insufficient
because JSON path is relative for some fieldno. Those root field
identifiers also must coincide.
Follow up #1257
---
https://github.com/tarantool/tarantool/commits/kshch/multikey-incompatable-parts-fixup
src/box/key_def.c | 3 ++-
test/engine/multikey.result | 4 ++++
test/engine/multikey.test.lua | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/box/key_def.c b/src/box/key_def.c
index fc547570f..eebfb7fe4 100644
--- a/src/box/key_def.c
+++ b/src/box/key_def.c
@@ -181,7 +181,8 @@ key_def_set_part_path(struct key_def *def, uint32_t part_no, const char *path,
def->multikey_path = part->path;
def->multikey_fieldno = part->fieldno;
def->multikey_path_len = (uint32_t) multikey_path_len;
- } else if (json_path_cmp(path, multikey_path_len, def->multikey_path,
+ } else if (def->multikey_fieldno != part->fieldno ||
+ json_path_cmp(path, multikey_path_len, def->multikey_path,
def->multikey_path_len,
TUPLE_INDEX_BASE) != 0) {
diag_set(ClientError, ER_WRONG_INDEX_OPTIONS,
diff --git a/test/engine/multikey.result b/test/engine/multikey.result
index 302082270..968be4cc3 100644
--- a/test/engine/multikey.result
+++ b/test/engine/multikey.result
@@ -29,6 +29,10 @@ _ = s:create_index('idx2', {parts = {{3, 'str', path = '[*].fname'}, {3, 'str',
- error: 'Wrong index options (field 2): no more than one array index placeholder
[*] is allowed in JSON path'
...
+_ = s:create_index('idx2', {parts = {{2, 'str', path = '[*]'}, {3, 'str', path = '[*]'}}})
+---
+- error: 'Wrong index options (field 2): incompatable multikey index path'
+...
idx0 = s:create_index('idx0', {parts = {{3, 'str', path = '[1].fname'}}})
---
...
diff --git a/test/engine/multikey.test.lua b/test/engine/multikey.test.lua
index 6d974716a..ed7033494 100644
--- a/test/engine/multikey.test.lua
+++ b/test/engine/multikey.test.lua
@@ -11,6 +11,7 @@ pk = s:create_index('pk')
-- Test incompatible multikey index parts.
_ = s:create_index('idx3', {parts = {{3, 'str', path = '[*].fname'}, {3, 'str', path = '["data"][*].sname'}}})
_ = s:create_index('idx2', {parts = {{3, 'str', path = '[*].fname'}, {3, 'str', path = '[*].sname[*].a'}}})
+_ = s:create_index('idx2', {parts = {{2, 'str', path = '[*]'}, {3, 'str', path = '[*]'}}})
idx0 = s:create_index('idx0', {parts = {{3, 'str', path = '[1].fname'}}})
_ = s:create_index('idx', {parts = {{3, 'str', path = '[*].fname'}, {3, 'str', path = '[*].sname'}}})
idx0:drop()
--
2.21.0
next reply other threads:[~2019-05-23 7:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 7:15 Kirill Shcherbatov [this message]
2019-05-23 8:27 ` Vladimir Davydov
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=37db0e91be78bca289f50c77a405f1eb1dc36841.1558595664.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH v1 1/1] box: ban multikey index with multiple root field' \
/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