forked from tarantool/tarantool
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
box: move index_opts::hint check from Lua to space_check_index_def
The checks in box.schema.index.create() and box.schema.index.alter() were case sensitive, also it was possible to insert incorrect index options directly into `box.space._index`. Fixed by adding checks to memtx_space_check_index_def() and vinyl_space_check_index_def(). Closes tarantool#8937 NO_DOC=bugfix (cherry picked from commit 4e25384)
- Loading branch information
Showing
15 changed files
with
220 additions
and
29 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...elogs/unreleased/gh-8937-memtx-tree-index-doesnt-accept-true-option-for-hint.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## bugfix/core | ||
|
||
* Fixed a bug because of which it was impossible to set the `hint` option | ||
to `true` for TREE indexes (gh-8937). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- This script can be used only with Tarantool without the fix for gh-8937 (e.g. | ||
-- version 3.0.0-alpha1-62-g983a7ec21). | ||
|
||
box.cfg{} | ||
|
||
local s = box.schema.create_space('gh_8937_memtx') | ||
box.space._index:insert{s.id, 0, "pk", "hash", {hint = true}, {{0, "unsigned"}}} | ||
|
||
s = box.schema.create_space('gh_8937_vinyl', {engine = 'vinyl'}) | ||
box.space._index:insert{s.id, 0, "pk", "tree", {hint = true}, {{0, "unsigned"}}} | ||
|
||
box.snapshot() | ||
|
||
os.exit(0) |
22 changes: 22 additions & 0 deletions
22
test/box-luatest/gh_8937_recover_wrong_hint_options_test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local t = require('luatest') | ||
local g = t.group('gh-8937') | ||
|
||
g.before_all(function(cg) | ||
local server = require('luatest.server') | ||
cg.server = server:new{datadir = 'test/box-luatest/gh_8937_data'} | ||
cg.server:start() | ||
end) | ||
|
||
g.after_all(function(cg) | ||
cg.server:drop() | ||
end) | ||
|
||
-- Check that indexes are recovered without errors like: | ||
-- "Can't create or modify index 'pk' in space 'gh_8937_memtx': | ||
-- hint is only reasonable with memtx tree index". | ||
g.test_recovery = function(cg) | ||
cg.server:exec(function() | ||
t.assert_equals(box.space.gh_8937_memtx.index[0].name, "pk") | ||
t.assert_equals(box.space.gh_8937_vinyl.index[0].name, "pk") | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters