diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua index 66a27d287009a1d21229780fda83c70fa9f9c6f4..b4ea14a2e4d84475b566798854d06d10e8e3a57b 100644 --- a/src/box/lua/schema.lua +++ b/src/box/lua/schema.lua @@ -340,6 +340,7 @@ box.schema.index.create = function(space_id, name, options) end _index:insert{space_id, iid, name, options.type, unique, part_count, unpack(options.parts)} + return box.space[space_id].index[name] end box.schema.index.drop = function(space_id, index_id) diff --git a/test/big/hash.result b/test/big/hash.result index 5aa1a1b836e78bb3304477045112d8757cc252c2..b9a4de03136477f1712588a3d9709b5b8aaa4b21 100644 --- a/test/big/hash.result +++ b/test/big/hash.result @@ -10,7 +10,7 @@ dofile('utils.lua') hash = box.schema.create_space('tweedledum') --- ... -hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) --- ... -- Insert valid fields @@ -350,7 +350,7 @@ hash:truncate() hash.index['primary']:drop() --- ... -hash:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) --- ... -- Insert valid fields @@ -457,16 +457,16 @@ hash:truncate() hash.index['primary']:drop() --- ... -hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) --- ... -hash:create_index('field1', { type = 'hash', parts = {2, 'num'}, unique = true }) +tmp = hash:create_index('field1', { type = 'hash', parts = {2, 'num'}, unique = true }) --- ... -hash:create_index('field2', { type = 'hash', parts = {3, 'num'}, unique = true }) +tmp = hash:create_index('field2', { type = 'hash', parts = {3, 'num'}, unique = true }) --- ... -hash:create_index('field3', { type = 'hash', parts = {4, 'num'}, unique = true }) +tmp = hash:create_index('field3', { type = 'hash', parts = {4, 'num'}, unique = true }) --- ... hash:insert{0, 0, 0, 0} diff --git a/test/big/hash.test.lua b/test/big/hash.test.lua index b110045ce58cc67585fd5451d901639f3939b41b..7abc2a8436fc5e71c0ae99fad75a84d48b68dc19 100644 --- a/test/big/hash.test.lua +++ b/test/big/hash.test.lua @@ -7,7 +7,7 @@ dofile('utils.lua') -- 32-bit hash insert fields tests ------------------------------------------------------------------------------- hash = box.schema.create_space('tweedledum') -hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) -- Insert valid fields hash:insert{0, 'value1 v1.0', 'value2 v1.0'} @@ -160,7 +160,7 @@ hash:truncate() -- String hash inset fields tests ------------------------------------------------------------------------------- hash.index['primary']:drop() -hash:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) -- Insert valid fields hash:insert{'key 0', 'value1 v1.0', 'value2 v1.0'} @@ -212,10 +212,10 @@ hash:truncate() -- hash::replace tests ------------------------ hash.index['primary']:drop() -hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) -hash:create_index('field1', { type = 'hash', parts = {2, 'num'}, unique = true }) -hash:create_index('field2', { type = 'hash', parts = {3, 'num'}, unique = true }) -hash:create_index('field3', { type = 'hash', parts = {4, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = hash:create_index('field1', { type = 'hash', parts = {2, 'num'}, unique = true }) +tmp = hash:create_index('field2', { type = 'hash', parts = {3, 'num'}, unique = true }) +tmp = hash:create_index('field3', { type = 'hash', parts = {4, 'num'}, unique = true }) hash:insert{0, 0, 0, 0} hash:insert{1, 1, 1, 1} diff --git a/test/big/hash_multipart.result b/test/big/hash_multipart.result index be020f8b0fa3fc9c2e018a662082ed74d572f846..7d6bd7cbe5317b9837246ad7c24df489e1e681c0 100644 --- a/test/big/hash_multipart.result +++ b/test/big/hash_multipart.result @@ -4,10 +4,10 @@ dofile('utils.lua') hash = box.schema.create_space('tweedledum') --- ... -hash:create_index('primary', { type = 'hash', parts = {1, 'num', 2, 'str', 3, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num', 2, 'str', 3, 'num'}, unique = true }) --- ... -hash:create_index('unique', { type = 'hash', parts = {3, 'num', 5, 'num'}, unique = true }) +tmp = hash:create_index('unique', { type = 'hash', parts = {3, 'num', 5, 'num'}, unique = true }) --- ... -- insert rows diff --git a/test/big/hash_multipart.test.lua b/test/big/hash_multipart.test.lua index 5b782608530a48ab6a3259f6d12b207b14f24a7b..707b7ecca50d9ca9093aaf96d2b7aa800e775a1b 100644 --- a/test/big/hash_multipart.test.lua +++ b/test/big/hash_multipart.test.lua @@ -1,8 +1,8 @@ dofile('utils.lua') hash = box.schema.create_space('tweedledum') -hash:create_index('primary', { type = 'hash', parts = {1, 'num', 2, 'str', 3, 'num'}, unique = true }) -hash:create_index('unique', { type = 'hash', parts = {3, 'num', 5, 'num'}, unique = true }) +tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'num', 2, 'str', 3, 'num'}, unique = true }) +tmp = hash:create_index('unique', { type = 'hash', parts = {3, 'num', 5, 'num'}, unique = true }) -- insert rows hash:insert{0, 'foo', 0, '', 1} diff --git a/test/big/iterator.result b/test/big/iterator.result index 02ea5419e30bb4f98393fa0ea3b919d9b8bb3319..5d9369dd741369f8d512d4196cc7be6993e23c15 100644 --- a/test/big/iterator.result +++ b/test/big/iterator.result @@ -7,27 +7,27 @@ dofile('utils.lua') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true}) +idx1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true}) --- ... -- Tree single-part non-unique -space:create_index('i1', { type = 'tree', parts = {2, 'str'}, unique = false}) +idx2 = space:create_index('i1', { type = 'tree', parts = {2, 'str'}, unique = false}) --- ... -- Tree multi-part unique -space:create_index('i2', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true}) +idx3 = space:create_index('i2', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true}) --- ... -- Tree multi-part non-unique -space:create_index('i3', { type = 'tree', parts = {3, 'str', 4, 'str'}, unique = false }) +idx4 = space:create_index('i3', { type = 'tree', parts = {3, 'str', 4, 'str'}, unique = false }) --- ... -- Hash single-part unique -space:create_index('i4', { type = 'hash', parts = {1, 'str'}, unique = true}) +idx5 = space:create_index('i4', { type = 'hash', parts = {1, 'str'}, unique = true}) --- ... -- Hash multi-part unique -space:create_index('i5', { type = 'hash', parts = {2, 'str', 3, 'str'}, unique = true}) +idx6 = space:create_index('i5', { type = 'hash', parts = {2, 'str', 3, 'str'}, unique = true}) --- ... space:insert{'pid_001', 'sid_001', 'tid_998', 'a'} @@ -918,13 +918,13 @@ space:drop() space = box.schema.create_space('test', {temporary=true}) --- ... -space:create_index('primary', {type='HASH',unique=true}) +idx1 = space:create_index('primary', {type='HASH',unique=true}) --- ... -space:create_index('t1', {type='TREE',unique=true}) +idx2 = space:create_index('t1', {type='TREE',unique=true}) --- ... -space:create_index('t2', {type='TREE',unique=true}) +idx3 = space:create_index('t2', {type='TREE',unique=true}) --- ... box.space.test:insert{0} @@ -966,7 +966,7 @@ space:drop() space = box.schema.create_space('test', {temporary=true}) --- ... -space:create_index('primary', {type='TREE',unique=true}) +idx1 = space:create_index('primary', {type='TREE',unique=true}) --- ... space:insert{0} diff --git a/test/big/iterator.test.lua b/test/big/iterator.test.lua index 494173c067d1616e772f5fc05a3cacc68ca15879..f54914b6edd3428510172b70af989dc9ac70dc22 100644 --- a/test/big/iterator.test.lua +++ b/test/big/iterator.test.lua @@ -3,17 +3,17 @@ dofile('utils.lua') # Tree single-part unique space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true}) +idx1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true}) -- Tree single-part non-unique -space:create_index('i1', { type = 'tree', parts = {2, 'str'}, unique = false}) +idx2 = space:create_index('i1', { type = 'tree', parts = {2, 'str'}, unique = false}) -- Tree multi-part unique -space:create_index('i2', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true}) +idx3 = space:create_index('i2', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true}) -- Tree multi-part non-unique -space:create_index('i3', { type = 'tree', parts = {3, 'str', 4, 'str'}, unique = false }) +idx4 = space:create_index('i3', { type = 'tree', parts = {3, 'str', 4, 'str'}, unique = false }) -- Hash single-part unique -space:create_index('i4', { type = 'hash', parts = {1, 'str'}, unique = true}) +idx5 = space:create_index('i4', { type = 'hash', parts = {1, 'str'}, unique = true}) -- Hash multi-part unique -space:create_index('i5', { type = 'hash', parts = {2, 'str', 3, 'str'}, unique = true}) +idx6 = space:create_index('i5', { type = 'hash', parts = {2, 'str', 3, 'str'}, unique = true}) space:insert{'pid_001', 'sid_001', 'tid_998', 'a'} space:insert{'pid_002', 'sid_001', 'tid_997', 'a'} @@ -176,9 +176,9 @@ space:drop() ------------------------------------------------------------------------------- space = box.schema.create_space('test', {temporary=true}) -space:create_index('primary', {type='HASH',unique=true}) -space:create_index('t1', {type='TREE',unique=true}) -space:create_index('t2', {type='TREE',unique=true}) +idx1 = space:create_index('primary', {type='HASH',unique=true}) +idx2 = space:create_index('t1', {type='TREE',unique=true}) +idx3 = space:create_index('t2', {type='TREE',unique=true}) box.space.test:insert{0} box.space.test:insert{1} @@ -200,7 +200,7 @@ space:drop() ------------------------------------------------------------------------------- space = box.schema.create_space('test', {temporary=true}) -space:create_index('primary', {type='TREE',unique=true}) +idx1 = space:create_index('primary', {type='TREE',unique=true}) space:insert{0} space:insert{1} diff --git a/test/big/lua.result b/test/big/lua.result index f460a36fb00831d5afa9a7c4c6ee4a50b48acfda..4543a8f80531d18ead98466aca4594f4e0af1810 100644 --- a/test/big/lua.result +++ b/test/big/lua.result @@ -1,10 +1,10 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) --- ... -space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +tmp = space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) --- ... space:insert{'brave', 'new', 'world'} @@ -117,10 +117,10 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) --- ... -space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = false }) +tmp = space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = false }) --- ... space:insert{1234567, 'new', 'world'} @@ -168,7 +168,7 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... space:insert{tonumber64('18446744073709551615'), 'magic'} @@ -275,10 +275,10 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... -space:create_index('range', { type = 'tree', parts = {2, 'num', 1, 'num'}, unique = true }) +tmp = space:create_index('range', { type = 'tree', parts = {2, 'num', 1, 'num'}, unique = true }) --- ... space:insert{0, 0} @@ -363,10 +363,10 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) --- ... -space:create_index('i1', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +tmp = space:create_index('i1', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) --- ... pid = 1 @@ -487,10 +487,10 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) --- ... -space:create_index('i1', { type = 'tree', parts = {2, 'num', 3, 'num'}, unique = false }) +tmp = space:create_index('i1', { type = 'tree', parts = {2, 'num', 3, 'num'}, unique = false }) --- ... space:insert{1, 1, 1} @@ -585,7 +585,7 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) --- ... t = space:insert{'1', '2', '3', '4', '5', '6', '7'} @@ -768,7 +768,7 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... dofile('push.lua') @@ -852,7 +852,7 @@ space:drop() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {3, 'num', 2, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {3, 'num', 2, 'num'}, unique = true }) --- ... -- Print key fields in pk @@ -902,10 +902,10 @@ dofile('index_random_test.lua') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... -space:create_index('secondary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'num'}, unique = true }) --- ... ------------------------------------------------------------------------------- diff --git a/test/big/lua.test.lua b/test/big/lua.test.lua index 1a2531d4d123f8446f3b8253f56b5195fe8c7e1e..400d403d53e48fc66148a17e3629b8f501713c5a 100644 --- a/test/big/lua.test.lua +++ b/test/big/lua.test.lua @@ -1,6 +1,6 @@ space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) -space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) space:insert{'brave', 'new', 'world'} space:insert{'hello', 'old', 'world'} @@ -46,8 +46,8 @@ space:drop() -- Check range scan over multipart keys -- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) -space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = false }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('minmax', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = false }) space:insert{1234567, 'new', 'world'} space:insert{0, 'of', 'puppets'} @@ -68,7 +68,7 @@ space:drop() -- Lua 64bit numbers support -- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) space:insert{tonumber64('18446744073709551615'), 'magic'} tuple = space.index['primary']:get{tonumber64('18446744073709551615')} @@ -108,8 +108,8 @@ space:drop() -- lua select_reverse_range() testing -- https://blueprints.launchpad.net/tarantool/+spec/backward-tree-index-iterator space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) -space:create_index('range', { type = 'tree', parts = {2, 'num', 1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('range', { type = 'tree', parts = {2, 'num', 1, 'num'}, unique = true }) space:insert{0, 0} space:insert{1, 0} @@ -130,8 +130,8 @@ space:drop() -- Tests for box.index iterators -- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) -space:create_index('i1', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('i1', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) pid = 1 tid = 999 @@ -178,8 +178,8 @@ space:drop() -- -- https://blueprints.launchpad.net/tarantool/+spec/lua-builtin-size-of-subtree space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) -space:create_index('i1', { type = 'tree', parts = {2, 'num', 3, 'num'}, unique = false }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('i1', { type = 'tree', parts = {2, 'num', 3, 'num'}, unique = false }) space:insert{1, 1, 1} space:insert{2, 2, 0} space:insert{3, 2, 1} @@ -210,7 +210,7 @@ space:drop() -- Tests for lua tuple:transform() -- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) +tmp = space:create_index('primary', { type = 'hash', parts = {1, 'str'}, unique = true }) t = space:insert{'1', '2', '3', '4', '5', '6', '7'} t:transform(8, 0, '8', '9', '100') t:transform(1, 1) @@ -276,7 +276,7 @@ space:drop() -- lua box.auto_increment() testing space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) dofile('push.lua') push_collection(space, 0, 1038784, 'hello') @@ -310,7 +310,7 @@ space:drop() -- https://bugs.launchpad.net/tarantool/+bug/1042798 -- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {3, 'num', 2, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {3, 'num', 2, 'num'}, unique = true }) -- Print key fields in pk space.index['primary'].parts @@ -331,8 +331,8 @@ space:drop() -- dofile('index_random_test.lua') space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) -space:create_index('secondary', { type = 'hash', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'num'}, unique = true }) ------------------------------------------------------------------------------- -- TreeIndex::random() ------------------------------------------------------------------------------- diff --git a/test/big/sql.result b/test/big/sql.result index 26ca867c0c7a5498a394f05dcbee24a61d299a90..3124b009549d29b2c5b25672897ccbc166b9f475 100644 --- a/test/big/sql.result +++ b/test/big/sql.result @@ -7,10 +7,10 @@ box.schema.user.grant('test', 'execute,read,write', 'universe') s = box.schema.create_space('tweedledum', { id = 0 }) --- ... -s:create_index('primary', { type = 'tree', parts = { 1, 'str'} }) +index1 = s:create_index('primary', { type = 'tree', parts = { 1, 'str'} }) --- ... -s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'str'}}) +index2 = s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'str'}}) --- ... # diff --git a/test/big/sql.test.py b/test/big/sql.test.py index e814258ddb11e0842a731a080848d385c4cf5ff6..f462216a91251a1a32e322152eddc158117be1db 100644 --- a/test/big/sql.test.py +++ b/test/big/sql.test.py @@ -6,8 +6,8 @@ sql.sort = True admin("box.schema.user.create('test', { password = 'test' })") admin("box.schema.user.grant('test', 'execute,read,write', 'universe')") admin("s = box.schema.create_space('tweedledum', { id = 0 })") -admin("s:create_index('primary', { type = 'tree', parts = { 1, 'str'} })") -admin("s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'str'}})") +admin("index1 = s:create_index('primary', { type = 'tree', parts = { 1, 'str'} })") +admin("index2 = s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'str'}})") print """# # A test case for Bug#729758 diff --git a/test/big/tree_pk.result b/test/big/tree_pk.result index bb1911df7f449e3bc95e0143b4240b61f40f2158..da77322828d523a217567e9084adc1cdcd7a23b7 100644 --- a/test/big/tree_pk.result +++ b/test/big/tree_pk.result @@ -4,7 +4,7 @@ dofile('utils.lua') s0 = box.schema.create_space('tweedledum') --- ... -s0:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +i0 = s0:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... -- integer keys @@ -70,13 +70,13 @@ s0:insert{'12'} s1 = box.schema.create_space('tweedledee') --- ... -s1:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i1 = s1:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) --- ... s2 = box.schema.create_space('alice') --- ... -s2:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i2 = s2:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) --- ... -- string keys @@ -272,13 +272,13 @@ s2 = nil s0:truncate() --- ... -s0:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = true }) +i1 = s0:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = true }) --- ... -s0:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) +i2 = s0:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) --- ... -s0:create_index('i3', { type = 'tree', parts = {4, 'num'}, unique = true }) +i3 = s0:create_index('i3', { type = 'tree', parts = {4, 'num'}, unique = true }) --- ... s0:insert{0, 0, 0, 0} diff --git a/test/big/tree_pk.test.lua b/test/big/tree_pk.test.lua index 46519bf27e5f04eb9121b9eb0e4c1faee8bde5be..1afdcf3886037f796b029c7345af95268478d699 100644 --- a/test/big/tree_pk.test.lua +++ b/test/big/tree_pk.test.lua @@ -1,7 +1,7 @@ dofile('utils.lua') s0 = box.schema.create_space('tweedledum') -s0:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +i0 = s0:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) -- integer keys s0:insert{1, 'tuple'} @@ -26,10 +26,10 @@ s0:insert{''} s0:insert{'12'} s1 = box.schema.create_space('tweedledee') -s1:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i1 = s1:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) s2 = box.schema.create_space('alice') -s2:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i2 = s2:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) -- string keys s1:insert{'identifier', 'tuple'} @@ -107,9 +107,9 @@ s2 = nil -- s0:truncate() -s0:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = true }) -s0:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) -s0:create_index('i3', { type = 'tree', parts = {4, 'num'}, unique = true }) +i1 = s0:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = true }) +i2 = s0:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) +i3 = s0:create_index('i3', { type = 'tree', parts = {4, 'num'}, unique = true }) s0:insert{0, 0, 0, 0} s0:insert{1, 1, 1, 1} diff --git a/test/big/tree_pk_multipart.result b/test/big/tree_pk_multipart.result index 9c93f8694d533b3dd2b23d7cdf1cdf7beaea7f17..09d612e4e97b1833c814211017ba768a1aadd0dc 100644 --- a/test/big/tree_pk_multipart.result +++ b/test/big/tree_pk_multipart.result @@ -5,7 +5,7 @@ space = box.schema.create_space('tweedledum') --- ... -- Multipart primary key (sender nickname, receiver nickname, message id) -space:create_index('primary', { type = 'tree', parts = {1, 'str', 2, 'str', 3, 'num'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str', 2, 'str', 3, 'num'}, unique = true }) --- ... space:insert{'Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with cheese in Paris?'} @@ -365,10 +365,10 @@ space:len() space.index['primary']:drop() --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) --- ... -space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +i2 = space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) --- ... space:insert{'a', 'a', 'a'} @@ -467,7 +467,7 @@ space = box.schema.create_space('tweedledum') --- ... -- Multipart primary key (sender nickname, receiver nickname, message id) -space:create_index('primary', { type = 'tree', parts = {1, 'num', 3, 'num'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'num', 3, 'num'}, unique = true }) --- ... space:insert{1, 1} @@ -485,10 +485,10 @@ space:drop() space = box.schema.space.create('test') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) --- ... -space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +i2 = space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) --- ... --# setopt delimiter ';' diff --git a/test/big/tree_pk_multipart.test.lua b/test/big/tree_pk_multipart.test.lua index c38d023d63ca3c9ec1141ce459d4598464ba10e2..3caae7512a700db87e641b484138ed37fba790c3 100644 --- a/test/big/tree_pk_multipart.test.lua +++ b/test/big/tree_pk_multipart.test.lua @@ -3,7 +3,7 @@ -- space = box.schema.create_space('tweedledum') -- Multipart primary key (sender nickname, receiver nickname, message id) -space:create_index('primary', { type = 'tree', parts = {1, 'str', 2, 'str', 3, 'num'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str', 2, 'str', 3, 'num'}, unique = true }) space:insert{'Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with cheese in Paris?'} space:insert{'Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?'} @@ -117,8 +117,8 @@ space:len() --if an index is modified between calls -- space.index['primary']:drop() -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) -space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i2 = space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) space:insert{'a', 'a', 'a'} space:insert{'d', 'd', 'd'} @@ -161,7 +161,7 @@ space = nil space = box.schema.create_space('tweedledum') -- Multipart primary key (sender nickname, receiver nickname, message id) -space:create_index('primary', { type = 'tree', parts = {1, 'num', 3, 'num'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'num', 3, 'num'}, unique = true }) space:insert{1, 1} space:replace{1, 1} @@ -170,8 +170,8 @@ space:drop() -- test deletion of data one by one space = box.schema.space.create('test') -space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) -space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) +i1 = space:create_index('primary', { type = 'tree', parts = {1, 'str'}, unique = true }) +i2 = space:create_index('second', { type = 'tree', parts = {2, 'str', 3, 'str'}, unique = true }) --# setopt delimiter ';' for i = 1, 100 do v = tostring(i) diff --git a/test/big/tree_variants.result b/test/big/tree_variants.result index 5f5aaa65794d7ef455407c200a02cfe6ba703890..6d6c8f8d87048b7c8d49e88c1f0d0f1de5e50c31 100644 --- a/test/big/tree_variants.result +++ b/test/big/tree_variants.result @@ -1,25 +1,25 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +i0 = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) --- ... -space:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = false }) +i1 = space:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = false }) --- ... -space:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) +i2 = space:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) --- ... -space:create_index('i3', { type = 'tree', parts = {4, 'str', 5, 'str'}, unique = false }) +i3 = space:create_index('i3', { type = 'tree', parts = {4, 'str', 5, 'str'}, unique = false }) --- ... -space:create_index('i4', { type = 'tree', parts = {7, 'str', 6, 'str'}, unique = false }) +i4 = space:create_index('i4', { type = 'tree', parts = {7, 'str', 6, 'str'}, unique = false }) --- ... -space:create_index('i5', { type = 'tree', parts = {9, 'num'}, unique = false }) +i5 = space:create_index('i5', { type = 'tree', parts = {9, 'num'}, unique = false }) --- ... -space:create_index('i6', { type = 'tree', parts = {7, 'str', 6, 'str', 4, 'str', 5, 'str', 9, 'num'}, unique = true }) +i6 = space:create_index('i6', { type = 'tree', parts = {7, 'str', 6, 'str', 4, 'str', 5, 'str', 9, 'num'}, unique = true }) --- ... space:insert{0, 0, 100, 'Joe', 'Sixpack', 'Drinks', 'Amstel', 'bar', 2000} diff --git a/test/big/tree_variants.test.lua b/test/big/tree_variants.test.lua index ff0996440e7bfe392fbcd32069b9232c625279cb..94e98d955ca6f10c20def2d5de3aad1f7114827a 100644 --- a/test/big/tree_variants.test.lua +++ b/test/big/tree_variants.test.lua @@ -1,11 +1,11 @@ space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) -space:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = false }) -space:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) -space:create_index('i3', { type = 'tree', parts = {4, 'str', 5, 'str'}, unique = false }) -space:create_index('i4', { type = 'tree', parts = {7, 'str', 6, 'str'}, unique = false }) -space:create_index('i5', { type = 'tree', parts = {9, 'num'}, unique = false }) -space:create_index('i6', { type = 'tree', parts = {7, 'str', 6, 'str', 4, 'str', 5, 'str', 9, 'num'}, unique = true }) +i0 = space:create_index('primary', { type = 'tree', parts = {1, 'num'}, unique = true }) +i1 = space:create_index('i1', { type = 'tree', parts = {2, 'num'}, unique = false }) +i2 = space:create_index('i2', { type = 'tree', parts = {3, 'num'}, unique = false }) +i3 = space:create_index('i3', { type = 'tree', parts = {4, 'str', 5, 'str'}, unique = false }) +i4 = space:create_index('i4', { type = 'tree', parts = {7, 'str', 6, 'str'}, unique = false }) +i5 = space:create_index('i5', { type = 'tree', parts = {9, 'num'}, unique = false }) +i6 = space:create_index('i6', { type = 'tree', parts = {7, 'str', 6, 'str', 4, 'str', 5, 'str', 9, 'num'}, unique = true }) space:insert{0, 0, 100, 'Joe', 'Sixpack', 'Drinks', 'Amstel', 'bar', 2000} space:insert{1, 1, 200, 'Joe', 'Sixpack', 'Drinks', 'Heineken', 'bar', 2001} diff --git a/test/box/access.result b/test/box/access.result index 7ad11d39e9fed0a5ee2de6ac5226c74d2e5d3dc8..77be60714f3331a90ed28ce88173dc4476a747ee 100644 --- a/test/box/access.result +++ b/test/box/access.result @@ -195,7 +195,7 @@ box.schema.user.create('testus') s = box.schema.create_space('admin_space') --- ... -s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) +index = s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) --- ... box.schema.user.grant('testus', 'write', 'space', 'admin_space') @@ -435,7 +435,7 @@ box.session.su('twostep') twostep = box.schema.create_space('twostep') --- ... -twostep:create_index('primary') +index2 = twostep:create_index('primary') --- ... box.schema.func.create('test') diff --git a/test/box/access.test.lua b/test/box/access.test.lua index 8569e0ec32e5093cffe4a40b75c1dc6541e17ccf..6372776ca909db75228caefc7fde5632b9d5b763 100644 --- a/test/box/access.test.lua +++ b/test/box/access.test.lua @@ -88,7 +88,7 @@ c:close() -- restore from a snapshot box.schema.user.create('testus') s = box.schema.create_space('admin_space') -s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) +index = s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) box.schema.user.grant('testus', 'write', 'space', 'admin_space') s:drop() box.snapshot() @@ -184,7 +184,7 @@ box.schema.user.create('twostep') box.schema.user.grant('twostep', 'read,write,execute', 'universe') box.session.su('twostep') twostep = box.schema.create_space('twostep') -twostep:create_index('primary') +index2 = twostep:create_index('primary') box.schema.func.create('test') box.session.su('admin') box.schema.user.revoke('twostep', 'execute,read,write', 'universe') diff --git a/test/box/access_bin.result b/test/box/access_bin.result index e9f6c586f8e8277036ac79b9356e7add9c755b2a..c3591c28ffd0f81f0e19dd8156dd60da9b8bd193 100644 --- a/test/box/access_bin.result +++ b/test/box/access_bin.result @@ -40,7 +40,7 @@ box.schema.user.revoke('guest', 'read,write,execute', 'universe') setuid_space = box.schema.space.create('setuid_space') --- ... -setuid_space:create_index('primary') +index = setuid_space:create_index('primary') --- ... setuid_func = function() return box.space.setuid_space:auto_increment{} end @@ -109,7 +109,7 @@ setuid_space:drop() test = box.schema.space.create('test') --- ... -test:create_index('primary') +index = test:create_index('primary') --- ... box.schema.user.create('test', {password='test'}) diff --git a/test/box/access_bin.test.lua b/test/box/access_bin.test.lua index 7ff79d2bb53c448ae0f5df8cfdfe8b95481af5b1..febc73b92610fe738b1b7978b0cb6d9902b9315b 100644 --- a/test/box/access_bin.test.lua +++ b/test/box/access_bin.test.lua @@ -16,7 +16,7 @@ box.schema.user.revoke('guest', 'read,write,execute', 'universe') -- gh-488 suid functions -- setuid_space = box.schema.space.create('setuid_space') -setuid_space:create_index('primary') +index = setuid_space:create_index('primary') setuid_func = function() return box.space.setuid_space:auto_increment{} end box.schema.func.create('setuid_func') box.schema.user.grant('guest', 'execute', 'function', 'setuid_func') @@ -41,7 +41,7 @@ setuid_space:drop() -- any more -- test = box.schema.space.create('test') -test:create_index('primary') +index = test:create_index('primary') box.schema.user.create('test', {password='test'}) box.schema.user.grant('test', 'read,write', 'space','test') box.schema.user.grant('test', 'read', 'space', '_space') diff --git a/test/box/access_misc.result b/test/box/access_misc.result index 8f16512d6b234ef0adadf63427b7076aff317bef..fedbfeb0f1702f37efcc2b2790482cfbd832b776 100644 --- a/test/box/access_misc.result +++ b/test/box/access_misc.result @@ -34,7 +34,7 @@ box.schema.user.create('testus') s = box.schema.create_space('admin_space') --- ... -s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) +index = s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) --- ... s:insert({1}) @@ -412,7 +412,7 @@ s = box.schema.create_space('glade') box.schema.user.grant('testuser', 'read', 'space', 'glade') --- ... -s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) --- ... s:insert({1, 'A'}) diff --git a/test/box/access_misc.test.lua b/test/box/access_misc.test.lua index 33fcac39909548dc29f02950384b3b008b0a07bb..afe6d7be4ba750ce9f5a5afbe5e17063a5c1281f 100644 --- a/test/box/access_misc.test.lua +++ b/test/box/access_misc.test.lua @@ -16,7 +16,7 @@ box.schema.user.create('testus') box.schema.user.create('testus') s = box.schema.create_space('admin_space') -s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) +index = s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) s:insert({1}) s:insert({2}) -- @@ -174,7 +174,7 @@ box.schema.user.revoke('testuser', 'read, write, execute', 'universe') -- s = box.schema.create_space('glade') box.schema.user.grant('testuser', 'read', 'space', 'glade') -s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) s:insert({1, 'A'}) s:insert({2, 'B'}) s:insert({3, 'C'}) diff --git a/test/box/admin.result b/test/box/admin.result index 82da4e86bf979f63ca17ab5c6b2ea3b94ec767f7..3208964bc6e622906ab1a035d68f5edf9217972b 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -3,7 +3,7 @@ space = box.schema.create_space('tweedledum', { id = 0 }) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... --# push filter 'listen: .*' to 'listen: <uri>' diff --git a/test/box/admin.test.lua b/test/box/admin.test.lua index cf56cb87a00151305bd7d986dd04a96b1e832149..be6ba82033af65f526db9df65fa0ee7be302ff4f 100644 --- a/test/box/admin.test.lua +++ b/test/box/admin.test.lua @@ -2,7 +2,7 @@ --# start server default space = box.schema.create_space('tweedledum', { id = 0 }) -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --# push filter 'listen: .*' to 'listen: <uri>' help() diff --git a/test/box/alter.result b/test/box/alter.result index 2a8dee1478e6580871159c213b2d6e9689649f47..93d4866c93a82ea89cd8763bfcafe004dc825e16 100644 --- a/test/box/alter.result +++ b/test/box/alter.result @@ -346,7 +346,7 @@ auto:drop() s = box.schema.create_space('space') --- ... -s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) --- ... s:insert{1, 'a'} @@ -389,16 +389,16 @@ s = box.schema.create_space("test", {unknown = 'param'}) s = box.schema.create_space("test") --- ... -s:create_index('primary', {unique = true, parts = {0, 'NUM', 1, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {0, 'NUM', 1, 'STR'}}) --- - error: 'Illegal parameters, invalid index parts: field_no must be one-based' ... -s:create_index('primary', {unique = true, parts = {'NUM', 1, 'STR', 2}}) +index = s:create_index('primary', {unique = true, parts = {'NUM', 1, 'STR', 2}}) --- - error: 'Illegal parameters, options.parts: expected filed_no (number), type (string) pairs' ... -s:create_index('primary', {unique = true, parts = 'bug'}) +index = s:create_index('primary', {unique = true, parts = 'bug'}) --- - error: Illegal parameters, options parameter 'parts' should be of type table ... diff --git a/test/box/alter.test.lua b/test/box/alter.test.lua index 7c2c45d36e70d5470bbfd9ae94bd3466637a0e1c..3cf6025b2f5b95f5d7c737fc67c1ac1daab42143 100644 --- a/test/box/alter.test.lua +++ b/test/box/alter.test.lua @@ -132,7 +132,7 @@ auto:drop() -- gh-281 Crash after rename + replace + delete with multi-part index -- ------------------------------------------------------------------ s = box.schema.create_space('space') -s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {1, 'NUM', 2, 'STR'}}) s:insert{1, 'a'} box.space.space.index.primary:rename('secondary') box.space.space:replace{1,'The rain in Spain'} @@ -147,7 +147,7 @@ s = box.schema.create_space(42) s = box.schema.create_space("test", "bug") s = box.schema.create_space("test", {unknown = 'param'}) s = box.schema.create_space("test") -s:create_index('primary', {unique = true, parts = {0, 'NUM', 1, 'STR'}}) -s:create_index('primary', {unique = true, parts = {'NUM', 1, 'STR', 2}}) -s:create_index('primary', {unique = true, parts = 'bug'}) +index = s:create_index('primary', {unique = true, parts = {0, 'NUM', 1, 'STR'}}) +index = s:create_index('primary', {unique = true, parts = {'NUM', 1, 'STR', 2}}) +index = s:create_index('primary', {unique = true, parts = 'bug'}) s:drop() diff --git a/test/box/alter_limits.result b/test/box/alter_limits.result index 10bf75b93b1f2adddb6b2fb14ffec0a384f0bba1..2979bf6c37b05c4635b1f007f1059fd08ac89c90 100644 --- a/test/box/alter_limits.result +++ b/test/box/alter_limits.result @@ -165,7 +165,7 @@ s.enabled - false ... -- enabled/disabled transition -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) --- ... s.enabled @@ -233,7 +233,7 @@ s.field_count --- - 2 ... -s:create_index('primary') +index = s:create_index('primary') --- ... -- field_count actually works @@ -353,7 +353,7 @@ s = box.schema.create_space('test') ... --# setopt delimiter ';' for k=1, box.schema.INDEX_MAX, 1 do - s:create_index('i'..k, { type = 'hash' }) + index = s:create_index('i'..k, { type = 'hash' }) end; --- ... @@ -364,68 +364,68 @@ for k, v in pairs (s.index) do if v.id ~= 0 then v:drop() end end ... -- test limits enforced in key_def_check: -- unknown index type -s:create_index('test', { type = 'nosuchtype' }) +index = s:create_index('test', { type = 'nosuchtype' }) --- - error: Unsupported index type supplied for index 1 in space 512 ... -- hash index is not unique -s:create_index('test', { type = 'hash', unique = false }) +index = s:create_index('test', { type = 'hash', unique = false }) --- - error: 'Can''t create or modify index 1 in space 512: HASH index must be unique' ... -- bitset index is unique -s:create_index('test', { type = 'bitset', unique = true }) +index = s:create_index('test', { type = 'bitset', unique = true }) --- - error: 'Can''t create or modify index 1 in space 512: BITSET can not be unique' ... -- bitset index is multipart -s:create_index('test', { type = 'bitset', parts = {1, 'num', 2, 'num'}}) +index = s:create_index('test', { type = 'bitset', parts = {1, 'num', 2, 'num'}}) --- - error: 'Can''t create or modify index 1 in space 512: BITSET index key can not be multipart' ... -- part count must be positive -s:create_index('test', { type = 'hash', parts = {}}) +index = s:create_index('test', { type = 'hash', parts = {}}) --- - error: 'Can''t create or modify index 1 in space 512: part count must be positive' ... -- part count must be positive -s:create_index('test', { type = 'hash', parts = { 1 }}) +index = s:create_index('test', { type = 'hash', parts = { 1 }}) --- - error: 'Illegal parameters, options.parts: expected filed_no (number), type (string) pairs' ... -- unknown field type -s:create_index('test', { type = 'hash', parts = { 1, 'nosuchtype' }}) +index = s:create_index('test', { type = 'hash', parts = { 1, 'nosuchtype' }}) --- - error: 'Can''t create or modify index 1 in space 512: unknown field type' ... -- bad field no -s:create_index('test', { type = 'hash', parts = { 'qq', 'nosuchtype' }}) +index = s:create_index('test', { type = 'hash', parts = { 'qq', 'nosuchtype' }}) --- - error: 'Illegal parameters, options.parts: expected filed_no (number), type (string) pairs' ... -- big field no -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX, 'num' }}) --- - error: 'Can''t create or modify index 1 in space 512: field no is too big' ... -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX - 1, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX - 1, 'num' }}) --- - error: 'Can''t create or modify index 1 in space 512: field no is too big' ... -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX + 90, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX + 90, 'num' }}) --- - error: 'Can''t create or modify index 1 in space 512: field no is too big' ... -s:create_index('test', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX + 1, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX + 1, 'num' }}) --- ... -s:create_index('t1', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX, 'num' }}) +index = s:create_index('t1', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX, 'num' }}) --- ... -s:create_index('t2', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX - 1, 'num' }}) +index = s:create_index('t2', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX - 1, 'num' }}) --- ... -- cleanup @@ -436,7 +436,7 @@ s = box.schema.create_space('test') --- ... -- same part can't be indexed twice -s:create_index('t1', { type = 'hash', parts = { 1, 'num', 1, 'str' }}) +index = s:create_index('t1', { type = 'hash', parts = { 1, 'num', 1, 'str' }}) --- - error: 'Can''t create or modify index 0 in space 512: same key part is indexed twice' ... @@ -455,7 +455,7 @@ end; --- - 512 ... -s:create_index('t1', { type = 'hash', parts = parts}); +index = s:create_index('t1', { type = 'hash', parts = parts}); --- - error: 'Can''t create or modify index 0 in space 512: too many key parts' ... @@ -472,7 +472,7 @@ end; --- - 510 ... -s:create_index('t1', { type = 'hash', parts = parts}); +index = s:create_index('t1', { type = 'hash', parts = parts}); --- ... --# setopt delimiter '' @@ -490,17 +490,17 @@ s:drop() s = box.schema.create_space('test') --- ... -s:create_index('t1', { type = 'hash' }) +index = s:create_index('t1', { type = 'hash' }) --- ... -- field type contradicts field type of another index -s:create_index('t2', { type = 'hash', parts = { 1, 'str' }}) +index = s:create_index('t2', { type = 'hash', parts = { 1, 'str' }}) --- - error: Ambiguous field type in index 1, key part 0. Requested type is STR but the field has previously been defined as NUM ... -- ok -s:create_index('t2', { type = 'hash', parts = { 2, 'str' }}) +index = s:create_index('t2', { type = 'hash', parts = { 2, 'str' }}) --- ... -- don't allow drop of the primary key in presence of other keys @@ -516,7 +516,7 @@ s:drop() s = box.schema.create_space('test') --- ... -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) --- ... -- space cache is updated correctly @@ -614,7 +614,7 @@ s:drop() s = box.schema.create_space('test') --- ... -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) --- ... -- correct error on misuse of alter @@ -670,14 +670,14 @@ s.index.pk:rename('primary') - error: '[string "return s.index.pk:rename(''primary'') "]:1: attempt to index field ''pk'' (a nil value)' ... -s:create_index('second', { type = 'tree', parts = { 2, 'str' } }) +index = s:create_index('second', { type = 'tree', parts = { 2, 'str' } }) --- ... s.index.second.id --- - 1 ... -s:create_index('third', { type = 'hash', parts = { 3, 'num' } }) +index = s:create_index('third', { type = 'hash', parts = { 3, 'num' } }) --- ... s.index.third:rename('second') @@ -715,7 +715,7 @@ s:drop() s = box.schema.create_space('full') --- ... -s:create_index('primary', { type = 'tree', parts = { 1, 'str' }}) +index = s:create_index('primary', { type = 'tree', parts = { 1, 'str' }}) --- ... s:insert{'No such movie', 999} @@ -747,7 +747,7 @@ s:insert{'Die Fremde', 2010} - ['Die Fremde', 2010] ... -- create index with data -s:create_index('year', { type = 'tree', unique=false, parts = { 2, 'num'} }) +index = s:create_index('year', { type = 'tree', unique=false, parts = { 2, 'num'} }) --- ... s.index.primary:select{} @@ -761,7 +761,7 @@ s.index.primary:select{} - ['No such movie', 999] ... -- a duplicate in the created index -s:create_index('nodups', { type = 'tree', unique=true, parts = { 2, 'num'} }) +index = s:create_index('nodups', { type = 'tree', unique=true, parts = { 2, 'num'} }) --- - error: Duplicate key exists in unique index 2 ... @@ -785,13 +785,13 @@ box.space['_index']:update({s.id, s.index.year.id}, {{"=", 8, 'num'}}) - [512, 1, 'year', 'tree', 0, 1, 1, 'num'] ... -- ambiguous field type -s:create_index('str', { type = 'tree', unique = false, parts = { 2, 'str'}}) +index = s:create_index('str', { type = 'tree', unique = false, parts = { 2, 'str'}}) --- - error: Ambiguous field type in index 2, key part 0. Requested type is STR but the field has previously been defined as NUM ... -- create index on a non-existing field -s:create_index('nosuchfield', { type = 'tree', unique = true, parts = { 3, 'str'}}) +index = s:create_index('nosuchfield', { type = 'tree', unique = true, parts = { 3, 'str'}}) --- - error: Tuple field count 2 is less than required by a defined index (expected 3) ... @@ -803,7 +803,7 @@ s:insert{'Der Baader Meinhof Komplex', '2009 '} - ['Der Baader Meinhof Komplex', '2009 '] ... -- create an index on a field with a wrong type -s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) +index = s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) --- - error: 'Tuple field 1 type does not match one required by operation: expected NUM' ... @@ -812,7 +812,7 @@ s:replace{'Der Baader Meinhof Komplex'} --- - ['Der Baader Meinhof Komplex'] ... -s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) +index = s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) --- - error: Tuple field count 1 is less than required by a defined index (expected 2) ... @@ -824,19 +824,19 @@ s = box.schema.create_space('test') --- ... -- primary key must be unique -s:create_index('primary', { unique = false }) +index = s:create_index('primary', { unique = false }) --- - error: 'Can''t create or modify index 0 in space 512: primary key must be unique' ... -- create primary key -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) --- ... s:insert{1, 1} --- - [1, 1] ... -s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'num'}}) +index = s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'num'}}) --- ... s:insert{2, 1} @@ -881,7 +881,7 @@ s = box.schema.create_space('test') s1 = s --- ... -s:create_index('primary') +index = s:create_index('primary') --- ... s1.index.primary.id @@ -916,19 +916,19 @@ s:drop() s_empty = box.schema.create_space('s_empty') --- ... -s_empty:create_index('primary') +indexe1 = s_empty:create_index('primary') --- ... -s_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexe2 = s_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) --- ... s_full = box.schema.create_space('s_full') --- ... -s_full:create_index('primary') +indexf1 = s_full:create_index('primary') --- ... -s_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexf2 = s_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) --- ... s_full:insert{1, 1, 'a'} @@ -964,7 +964,7 @@ box.snapshot() s_drop:drop() --- ... -s_nil:create_index('primary', { type = 'hash'}) +indexn1 = s_nil:create_index('primary', { type = 'hash'}) --- ... s_nil:insert{1,2,3,4,5,6} @@ -975,7 +975,7 @@ s_nil:insert{7, 8, 9, 10, 11,12} --- - [7, 8, 9, 10, 11, 12] ... -s_nil:create_index('secondary', { type = 'tree', unique=false, parts = {2, 'num', 3, 'num', 4, 'num'}}) +indexn2 = s_nil:create_index('secondary', { type = 'tree', unique=false, parts = {2, 'num', 3, 'num', 4, 'num'}}) --- ... s_nil:insert{13, 14, 15, 16, 17} @@ -985,19 +985,19 @@ s_nil:insert{13, 14, 15, 16, 17} r_empty = box.schema.create_space('r_empty') --- ... -r_empty:create_index('primary') +indexe1 = r_empty:create_index('primary') --- ... -r_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexe2 = r_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) --- ... r_full = box.schema.create_space('r_full') --- ... -r_full:create_index('primary', { type = 'tree', unique = true, parts = {1, 'num'}}) +indexf1 = r_full:create_index('primary', { type = 'tree', unique = true, parts = {1, 'num'}}) --- ... -r_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexf2 = r_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) --- ... r_full:insert{1, 1, 'a'} @@ -1020,7 +1020,7 @@ r_full:insert{5, 5, 'e'} --- - [5, 5, 'e'] ... -s_full:create_index('multikey', { type = 'tree', unique = true, parts = { 2, 'num', 3, 'str'}}) +indexf1 = s_full:create_index('multikey', { type = 'tree', unique = true, parts = { 2, 'num', 3, 'str'}}) --- ... s_full:insert{6, 6, 'f'} @@ -1193,6 +1193,10 @@ s_nil.index.secondary:count(1) i1 = s_empty:create_index("test") --- ... +i1:select{} +--- +- [] +... i2 = s_empty:create_index("test") --- - error: Index 'test' already exists diff --git a/test/box/alter_limits.test.lua b/test/box/alter_limits.test.lua index 73f87152d589d17a09ee24f953e0a326f21887aa..ce4b581f5298f58dde4bc2c52f1c212471b004f0 100644 --- a/test/box/alter_limits.test.lua +++ b/test/box/alter_limits.test.lua @@ -58,7 +58,7 @@ s.index[0] s:truncate() s.enabled -- enabled/disabled transition -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) s.enabled -- rename space - same name s:rename('tweedledum') @@ -82,7 +82,7 @@ s.id s:drop() s = box.schema.create_space('test', { field_count = 2 }) s.field_count -s:create_index('primary') +index = s:create_index('primary') -- field_count actually works s:insert{1} s:insert{1, 2} @@ -128,40 +128,40 @@ s:drop() s = box.schema.create_space('test') --# setopt delimiter ';' for k=1, box.schema.INDEX_MAX, 1 do - s:create_index('i'..k, { type = 'hash' }) + index = s:create_index('i'..k, { type = 'hash' }) end; --# setopt delimiter '' -- cleanup for k, v in pairs (s.index) do if v.id ~= 0 then v:drop() end end -- test limits enforced in key_def_check: -- unknown index type -s:create_index('test', { type = 'nosuchtype' }) +index = s:create_index('test', { type = 'nosuchtype' }) -- hash index is not unique -s:create_index('test', { type = 'hash', unique = false }) +index = s:create_index('test', { type = 'hash', unique = false }) -- bitset index is unique -s:create_index('test', { type = 'bitset', unique = true }) +index = s:create_index('test', { type = 'bitset', unique = true }) -- bitset index is multipart -s:create_index('test', { type = 'bitset', parts = {1, 'num', 2, 'num'}}) +index = s:create_index('test', { type = 'bitset', parts = {1, 'num', 2, 'num'}}) -- part count must be positive -s:create_index('test', { type = 'hash', parts = {}}) +index = s:create_index('test', { type = 'hash', parts = {}}) -- part count must be positive -s:create_index('test', { type = 'hash', parts = { 1 }}) +index = s:create_index('test', { type = 'hash', parts = { 1 }}) -- unknown field type -s:create_index('test', { type = 'hash', parts = { 1, 'nosuchtype' }}) +index = s:create_index('test', { type = 'hash', parts = { 1, 'nosuchtype' }}) -- bad field no -s:create_index('test', { type = 'hash', parts = { 'qq', 'nosuchtype' }}) +index = s:create_index('test', { type = 'hash', parts = { 'qq', 'nosuchtype' }}) -- big field no -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX, 'num' }}) -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX - 1, 'num' }}) -s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX + 90, 'num' }}) -s:create_index('test', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX + 1, 'num' }}) -s:create_index('t1', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX, 'num' }}) -s:create_index('t2', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX - 1, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX - 1, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.FIELD_MAX + 90, 'num' }}) +index = s:create_index('test', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX + 1, 'num' }}) +index = s:create_index('t1', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX, 'num' }}) +index = s:create_index('t2', { type = 'hash', parts = { box.schema.INDEX_FIELD_MAX - 1, 'num' }}) -- cleanup s:drop() s = box.schema.create_space('test') -- same part can't be indexed twice -s:create_index('t1', { type = 'hash', parts = { 1, 'num', 1, 'str' }}) +index = s:create_index('t1', { type = 'hash', parts = { 1, 'num', 1, 'str' }}) -- a lot of key parts parts = {} --# setopt delimiter ';' @@ -170,14 +170,14 @@ for k=1, box.schema.INDEX_PART_MAX + 1, 1 do table.insert(parts, 'num') end; #parts; -s:create_index('t1', { type = 'hash', parts = parts}); +index = s:create_index('t1', { type = 'hash', parts = parts}); parts = {}; for k=1, box.schema.INDEX_PART_MAX, 1 do table.insert(parts, k + 1) table.insert(parts, 'num') end; #parts; -s:create_index('t1', { type = 'hash', parts = parts}); +index = s:create_index('t1', { type = 'hash', parts = parts}); --# setopt delimiter '' -- this is actually incorrect since parts is a lua table -- and length of a lua table which has index 0 set is not correct @@ -186,18 +186,18 @@ s:create_index('t1', { type = 'hash', parts = parts}); s:drop() -- check costraints in tuple_format_new() s = box.schema.create_space('test') -s:create_index('t1', { type = 'hash' }) +index = s:create_index('t1', { type = 'hash' }) -- field type contradicts field type of another index -s:create_index('t2', { type = 'hash', parts = { 1, 'str' }}) +index = s:create_index('t2', { type = 'hash', parts = { 1, 'str' }}) -- ok -s:create_index('t2', { type = 'hash', parts = { 2, 'str' }}) +index = s:create_index('t2', { type = 'hash', parts = { 2, 'str' }}) -- don't allow drop of the primary key in presence of other keys s.index[0]:drop() -- cleanup s:drop() -- index name, name manipulation s = box.schema.create_space('test') -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) -- space cache is updated correctly s.index[0].name s.index[0].id @@ -227,7 +227,7 @@ s.index.primary.name s:drop() -- modify index s = box.schema.create_space('test') -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) -- correct error on misuse of alter s.index.primary.alter({unique=false}) s.index.primary:alter({unique=false}) @@ -239,9 +239,9 @@ s.index.primary s.index.pk.type s.index.pk.unique s.index.pk:rename('primary') -s:create_index('second', { type = 'tree', parts = { 2, 'str' } }) +index = s:create_index('second', { type = 'tree', parts = { 2, 'str' } }) s.index.second.id -s:create_index('third', { type = 'hash', parts = { 3, 'num' } }) +index = s:create_index('third', { type = 'hash', parts = { 3, 'num' } }) s.index.third:rename('second') s.index.third.id s.index.second:drop() @@ -254,7 +254,7 @@ s:drop() -- BUILD INDEX: changes of a non-empty index -- ---------------------------------------------------------------- s = box.schema.create_space('full') -s:create_index('primary', { type = 'tree', parts = { 1, 'str' }}) +index = s:create_index('primary', { type = 'tree', parts = { 1, 'str' }}) s:insert{'No such movie', 999} s:insert{'Barbara', 2012} s:insert{'Cloud Atlas', 2012} @@ -263,34 +263,34 @@ s:insert{'Halt auf freier Strecke', 2011} s:insert{'Homevideo', 2011} s:insert{'Die Fremde', 2010} -- create index with data -s:create_index('year', { type = 'tree', unique=false, parts = { 2, 'num'} }) +index = s:create_index('year', { type = 'tree', unique=false, parts = { 2, 'num'} }) s.index.primary:select{} -- a duplicate in the created index -s:create_index('nodups', { type = 'tree', unique=true, parts = { 2, 'num'} }) +index = s:create_index('nodups', { type = 'tree', unique=true, parts = { 2, 'num'} }) -- change of non-unique index to unique: same effect s.index.year:alter({unique=true}) s.index.primary:select{} box.space['_index']:update({s.id, s.index.year.id}, {{"=", 8, 'num'}}) -- ambiguous field type -s:create_index('str', { type = 'tree', unique = false, parts = { 2, 'str'}}) +index = s:create_index('str', { type = 'tree', unique = false, parts = { 2, 'str'}}) -- create index on a non-existing field -s:create_index('nosuchfield', { type = 'tree', unique = true, parts = { 3, 'str'}}) +index = s:create_index('nosuchfield', { type = 'tree', unique = true, parts = { 3, 'str'}}) s.index.year:drop() s:insert{'Der Baader Meinhof Komplex', '2009 '} -- create an index on a field with a wrong type -s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) +index = s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) -- a field is missing s:replace{'Der Baader Meinhof Komplex'} -s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) +index = s:create_index('year', { type = 'tree', unique = false, parts = { 2, 'num'}}) s:drop() -- unique -> non-unique transition s = box.schema.create_space('test') -- primary key must be unique -s:create_index('primary', { unique = false }) +index = s:create_index('primary', { unique = false }) -- create primary key -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) s:insert{1, 1} -s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'num'}}) +index = s:create_index('secondary', { type = 'tree', unique = false, parts = {2, 'num'}}) s:insert{2, 1} s.index.secondary:alter{ unique = true } s:delete{2} @@ -305,7 +305,7 @@ s:drop() -- ---------------------------------------------------------------- s = box.schema.create_space('test') s1 = s -s:create_index('primary') +index = s:create_index('primary') s1.index.primary.id primary = s1.index.primary s.index.primary:drop() @@ -321,12 +321,12 @@ s:drop() -- ---------------------------------------------------------------- -- primary, secondary keys in a snapshot s_empty = box.schema.create_space('s_empty') -s_empty:create_index('primary') -s_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexe1 = s_empty:create_index('primary') +indexe2 = s_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) s_full = box.schema.create_space('s_full') -s_full:create_index('primary') -s_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexf1 = s_full:create_index('primary') +indexf2 = s_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) s_full:insert{1, 1, 'a'} s_full:insert{2, 2, 'b'} @@ -342,19 +342,19 @@ box.snapshot() s_drop:drop() -s_nil:create_index('primary', { type = 'hash'}) +indexn1 = s_nil:create_index('primary', { type = 'hash'}) s_nil:insert{1,2,3,4,5,6} s_nil:insert{7, 8, 9, 10, 11,12} -s_nil:create_index('secondary', { type = 'tree', unique=false, parts = {2, 'num', 3, 'num', 4, 'num'}}) +indexn2 = s_nil:create_index('secondary', { type = 'tree', unique=false, parts = {2, 'num', 3, 'num', 4, 'num'}}) s_nil:insert{13, 14, 15, 16, 17} r_empty = box.schema.create_space('r_empty') -r_empty:create_index('primary') -r_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexe1 = r_empty:create_index('primary') +indexe2 = r_empty:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) r_full = box.schema.create_space('r_full') -r_full:create_index('primary', { type = 'tree', unique = true, parts = {1, 'num'}}) -r_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) +indexf1 = r_full:create_index('primary', { type = 'tree', unique = true, parts = {1, 'num'}}) +indexf2 = r_full:create_index('secondary', { type = 'hash', unique = true, parts = {2, 'num'}}) r_full:insert{1, 1, 'a'} r_full:insert{2, 2, 'b'} @@ -362,7 +362,7 @@ r_full:insert{3, 3, 'c'} r_full:insert{4, 4, 'd'} r_full:insert{5, 5, 'e'} -s_full:create_index('multikey', { type = 'tree', unique = true, parts = { 2, 'num', 3, 'str'}}) +indexf1 = s_full:create_index('multikey', { type = 'tree', unique = true, parts = { 2, 'num', 3, 'str'}}) s_full:insert{6, 6, 'f'} s_full:insert{7, 7, 'g'} s_full:insert{8, 8, 'h'} @@ -421,6 +421,7 @@ s_nil.index.secondary:count(1) -- gh-503 if_not_exits option in create index i1 = s_empty:create_index("test") +i1:select{} i2 = s_empty:create_index("test") i3 = s_empty:create_index("test", { if_not_exists = true } ) i3:select{} diff --git a/test/box/box.net.box.result b/test/box/box.net.box.result index 1c0b7af47d7b1574ee1aa4bb4903967f6061bd97..58c38375be26804809d6ce1e6d56307612c8f09a 100644 --- a/test/box/box.net.box.result +++ b/test/box/box.net.box.result @@ -19,7 +19,7 @@ LISTEN = require('uri').parse(box.cfg.listen) space = box.schema.create_space('net_box_test_space') --- ... -space:create_index('primary', { type = 'tree' }) +index = space:create_index('primary', { type = 'tree' }) --- ... -- low level connection diff --git a/test/box/box.net.box.test.lua b/test/box/box.net.box.test.lua index e1b7396b052abe0e74b7ac37f9759e8433b61377..9803bc9c5061ea4750a355e8290ebea3385dc06e 100644 --- a/test/box/box.net.box.test.lua +++ b/test/box/box.net.box.test.lua @@ -6,7 +6,7 @@ msgpack = require 'msgpack' box.schema.user.grant('guest', 'read,write,execute', 'universe') LISTEN = require('uri').parse(box.cfg.listen) space = box.schema.create_space('net_box_test_space') -space:create_index('primary', { type = 'tree' }) +index = space:create_index('primary', { type = 'tree' }) -- low level connection log.info("create connection") diff --git a/test/box/call.result b/test/box/call.result index b9f77a9f4c95db8257b4f8cb145fdbb5eff9abcd..b23515307bdc5e832ec3a19ea029e2f93f3ea62a 100644 --- a/test/box/call.result +++ b/test/box/call.result @@ -186,7 +186,7 @@ call f1('jason', 1, 'test', 2, 'stewart') space = box.schema.create_space('tweedledum', { id = 0 }) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... function myreplace(...) return space:replace{...} end diff --git a/test/box/call.test.py b/test/box/call.test.py index bfb30d386a9509b7842ada91e683100b23fb9766..d1681f28ea299c8e617b9086e4f74bbef3cf2420 100644 --- a/test/box/call.test.py +++ b/test/box/call.test.py @@ -69,7 +69,7 @@ sql("call f1('jason')") sql("call f1('jason', 1, 'test', 2, 'stewart')") admin("space = box.schema.create_space('tweedledum', { id = 0 })") -admin("space:create_index('primary', { type = 'hash' })") +admin("index = space:create_index('primary', { type = 'hash' })") admin("function myreplace(...) return space:replace{...} end") admin("function myinsert(...) return space:insert{...} end") diff --git a/test/box/crossjoin.result b/test/box/crossjoin.result index ef64f6e841fac440068f04846a6c61c2e8a82b03..3898aa417cba0f3c908ab1430690f25caefd1a2f 100644 --- a/test/box/crossjoin.result +++ b/test/box/crossjoin.result @@ -1,7 +1,7 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree' }) +index = space:create_index('primary', { type = 'tree' }) --- ... --# setopt delimiter ';' diff --git a/test/box/crossjoin.test.lua b/test/box/crossjoin.test.lua index 5919ae40b5cd6f10a6f4fa0006af4cebc643e388..2c168de1be63b47a5e4f1cc79013918ed1455b4d 100644 --- a/test/box/crossjoin.test.lua +++ b/test/box/crossjoin.test.lua @@ -1,5 +1,5 @@ space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree' }) +index = space:create_index('primary', { type = 'tree' }) --# setopt delimiter ';' function crossjoin(space0, space1, limit) local result = {} diff --git a/test/box/errinj.result b/test/box/errinj.result index e525ed83c1d11dab10a269a7d30ab154aca470f6..204d1ddda9c0ba993046521b96ec3227f0c86583 100644 --- a/test/box/errinj.result +++ b/test/box/errinj.result @@ -4,7 +4,7 @@ errinj = require('box.error.injection') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... errinj.info() @@ -158,13 +158,13 @@ s_disabled = box.schema.create_space('disabled') s_withindex = box.schema.create_space('withindex') --- ... -s_withindex:create_index('primary', { type = 'hash' }) +index1 = s_withindex:create_index('primary', { type = 'hash' }) --- ... s_withdata = box.schema.create_space('withdata') --- ... -s_withdata:create_index('primary', { type = 'tree' }) +index2 = s_withdata:create_index('primary', { type = 'tree' }) --- ... s_withdata:insert{1, 2, 3, 4, 5} @@ -175,7 +175,7 @@ s_withdata:insert{4, 5, 6, 7, 8} --- - [4, 5, 6, 7, 8] ... -s_withdata:create_index('secondary', { type = 'hash', parts = {2, 'num', 3, 'num' }}) +index3 = s_withdata:create_index('secondary', { type = 'hash', parts = {2, 'num', 3, 'num' }}) --- ... errinj.set("ERRINJ_WAL_IO", true) @@ -222,7 +222,7 @@ box.space['withdata'].enabled --- - true ... -s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) +index4 = s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) --- - error: Failed to write to disk ... @@ -237,7 +237,7 @@ errinj.set("ERRINJ_WAL_IO", false) test = box.schema.create_space('test') --- ... -s_disabled:create_index('primary', { type = 'hash' }) +index5 = s_disabled:create_index('primary', { type = 'hash' }) --- ... s_disabled.enabled @@ -248,7 +248,7 @@ s_disabled:insert{0} --- - [0] ... -s_withindex:create_index('secondary', { type = 'tree', parts = { 2, 'num'} }) +index6 = s_withindex:create_index('secondary', { type = 'tree', parts = { 2, 'num'} }) --- ... s_withindex.index.secondary.unique @@ -269,7 +269,7 @@ box.space['withdata'] --- - null ... -s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) +index7 = s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) --- - error: Space '#514' does not exist ... diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua index d16edf5c9d85b9de3c613aaef34e611b2fee85c7..78c50356fc794d661d5ef75c0ee3d5cae827c034 100644 --- a/test/box/errinj.test.lua +++ b/test/box/errinj.test.lua @@ -1,7 +1,7 @@ errinj = require('box.error.injection') space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) errinj.info() errinj.set("some-injection", true) @@ -48,12 +48,12 @@ space:drop() -- Check how well we handle a failed log write in DDL s_disabled = box.schema.create_space('disabled') s_withindex = box.schema.create_space('withindex') -s_withindex:create_index('primary', { type = 'hash' }) +index1 = s_withindex:create_index('primary', { type = 'hash' }) s_withdata = box.schema.create_space('withdata') -s_withdata:create_index('primary', { type = 'tree' }) +index2 = s_withdata:create_index('primary', { type = 'tree' }) s_withdata:insert{1, 2, 3, 4, 5} s_withdata:insert{4, 5, 6, 7, 8} -s_withdata:create_index('secondary', { type = 'hash', parts = {2, 'num', 3, 'num' }}) +index3 = s_withdata:create_index('secondary', { type = 'hash', parts = {2, 'num', 3, 'num' }}) errinj.set("ERRINJ_WAL_IO", true) test = box.schema.create_space('test') s_disabled:create_index('primary', { type = 'hash' }) @@ -65,20 +65,20 @@ s_withdata.index.secondary:drop() s_withdata.index.secondary.unique s_withdata:drop() box.space['withdata'].enabled -s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) +index4 = s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) s_withdata.index.another errinj.set("ERRINJ_WAL_IO", false) test = box.schema.create_space('test') -s_disabled:create_index('primary', { type = 'hash' }) +index5 = s_disabled:create_index('primary', { type = 'hash' }) s_disabled.enabled s_disabled:insert{0} -s_withindex:create_index('secondary', { type = 'tree', parts = { 2, 'num'} }) +index6 = s_withindex:create_index('secondary', { type = 'tree', parts = { 2, 'num'} }) s_withindex.index.secondary.unique s_withdata.index.secondary:drop() s_withdata.index.secondary s_withdata:drop() box.space['withdata'] -s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) +index7 = s_withdata:create_index('another', { type = 'tree', parts = { 5, 'num' }, unique = false}) s_withdata.index.another test:drop() s_disabled:drop() diff --git a/test/box/errinj_index.result b/test/box/errinj_index.result index 0bce3216dacf3de941595092b597ceb614018a3d..d79edc5b1ecac7a2cc142e74f0b023d93680657b 100644 --- a/test/box/errinj_index.result +++ b/test/box/errinj_index.result @@ -5,7 +5,7 @@ errinj = require('box.error.injection') s = box.schema.create_space('tweedledum') --- ... -s:create_index('primary', {type = 'tree'} ) +index = s:create_index('primary', {type = 'tree'} ) --- ... for i = 1,10 do s:insert{i, i, 'test' .. i} end @@ -264,7 +264,7 @@ s:drop() s = box.schema.create_space('tweedledum') --- ... -s:create_index('primary', {type = 'hash'} ) +index = s:create_index('primary', {type = 'hash'} ) --- ... for i = 1,10 do s:insert{i, i, 'test' .. i} end diff --git a/test/box/errinj_index.test.lua b/test/box/errinj_index.test.lua index 3a339d4aca6007e14c35271211903ab268327824..1913b50caca060a477a87fb30d3f67837a3d7419 100644 --- a/test/box/errinj_index.test.lua +++ b/test/box/errinj_index.test.lua @@ -3,7 +3,7 @@ errinj = require('box.error.injection') -- Check a failed realloc in tree index. s = box.schema.create_space('tweedledum') -s:create_index('primary', {type = 'tree'} ) +index = s:create_index('primary', {type = 'tree'} ) for i = 1,10 do s:insert{i, i, 'test' .. i} end res = {} @@ -70,7 +70,7 @@ s:drop() -- Check a failed realloc in hash index. s = box.schema.create_space('tweedledum') -s:create_index('primary', {type = 'hash'} ) +index = s:create_index('primary', {type = 'hash'} ) for i = 1,10 do s:insert{i, i, 'test' .. i} end res = {} diff --git a/test/box/fiber.result b/test/box/fiber.result index 13a1aa6044ed9b8a51b2f6744deef3477548b8f8..122647fce6f66abd91c21d28c08c370690380fd1 100644 --- a/test/box/fiber.result +++ b/test/box/fiber.result @@ -4,7 +4,7 @@ fiber = require('fiber') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... -- A test case for a race condition between ev_schedule diff --git a/test/box/fiber.test.lua b/test/box/fiber.test.lua index 258561e06c04dc5b89bbe9f055cd63c2dcb2b8c4..73eb308e2a9b72fa7de8f4095689677966009e90 100644 --- a/test/box/fiber.test.lua +++ b/test/box/fiber.test.lua @@ -1,6 +1,6 @@ fiber = require('fiber') space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) -- A test case for a race condition between ev_schedule -- and wal_schedule fiber schedulers. -- The same fiber should not be scheduled by ev_schedule (e.g. diff --git a/test/box/insert.result b/test/box/insert.result index 6542c0defcfa0dfb7212c7c02be7fbce6cdcdd90..f0d05321b1ea1bd4026a712ea61056d507fb1581 100644 --- a/test/box/insert.result +++ b/test/box/insert.result @@ -3,7 +3,7 @@ s = box.schema.create_space('s') --- ... -s:create_index('pk') +index = s:create_index('pk') --- ... s:insert(1) diff --git a/test/box/insert.test.lua b/test/box/insert.test.lua index 79e8d0ab5c07f7a33b529b22139c366b2c9747f1..5a106cf69d7139a6fe537a87911540d7d6b3bfeb 100644 --- a/test/box/insert.test.lua +++ b/test/box/insert.test.lua @@ -1,7 +1,7 @@ -- gh-186 New implementation of box.replace does not check that tuple is -- array s = box.schema.create_space('s') -s:create_index('pk') +index = s:create_index('pk') s:insert(1) s:insert(1, 2) s:insert(1, 2, 3) diff --git a/test/box/iproto.result b/test/box/iproto.result index 9b6826200771788236f0f5e126eac12457059c5c..fa577523ee906d71b657bd6fb7875cc39808a46c 100644 --- a/test/box/iproto.result +++ b/test/box/iproto.result @@ -76,7 +76,7 @@ box.cfg.wal_mode space = box.schema.create_space('test', { id = 567 }) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... box.schema.user.grant('guest', 'read,write,execute', 'space', 'test') @@ -112,7 +112,7 @@ space:drop() space = box.schema.create_space('test') --- ... -space:create_index('primary', { type = 'hash', parts = {1, 'str'}}) +index = space:create_index('primary', { type = 'hash', parts = {1, 'str'}}) --- ... STR 1 diff --git a/test/box/iproto.test.py b/test/box/iproto.test.py index beae1a2071420f679482daa96524a5d97b971851..4c8d511bbdf5a4b24e3d2602bdf29c92bf72e10c 100644 --- a/test/box/iproto.test.py +++ b/test/box/iproto.test.py @@ -93,7 +93,7 @@ print "\n" # gh-434 Tarantool crashes on multiple iproto requests with WAL enabled admin("box.cfg.wal_mode") admin("space = box.schema.create_space('test', { id = 567 })") -admin("space:create_index('primary', { type = 'hash' })") +admin("index = space:create_index('primary', { type = 'hash' })") admin("box.schema.user.grant('guest', 'read,write,execute', 'space', 'test')") c = Connection('localhost', server.sql.port) @@ -154,7 +154,7 @@ admin("space:drop()") # gh-522: Broken compatibility with msgpack-python for strings of size 33..255 # admin("space = box.schema.create_space('test')") -admin("space:create_index('primary', { type = 'hash', parts = {1, 'str'}})") +admin("index = space:create_index('primary', { type = 'hash', parts = {1, 'str'}})") class RawInsert(Request): request_type = REQUEST_TYPE_INSERT diff --git a/test/box/luafun.result b/test/box/luafun.result index 70f98792cf0d5b7b0cbae348535f4fc076a789bb..295e884b3cd11d8f857ee73e1d02d4786f03b9ae 100644 --- a/test/box/luafun.result +++ b/test/box/luafun.result @@ -4,7 +4,7 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... for i = 1,5,1 do space:replace({i, i}) end diff --git a/test/box/luafun.test.lua b/test/box/luafun.test.lua index d66aa5874bac1b80c73b64a5a71c84eb2ef4616b..f01bb9b3dac1610f5de0a3d6c16b9f23b3fd3eab 100644 --- a/test/box/luafun.test.lua +++ b/test/box/luafun.test.lua @@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) for i = 1,5,1 do space:replace({i, i}) end fun = require('fun') diff --git a/test/box/misc.result b/test/box/misc.result index b58402743425ee14bad1524e63dee097f671a491..247bff00e6063cc1e0ee8555a69c63a709727b5b 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -1,7 +1,7 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... -- Test Lua from admin console. Whenever producing output, diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua index 10edd169c8516ee26cee0b29bcb0373a693787ef..e0995a73ec4372beaf8957be68b60938c5ea80d2 100644 --- a/test/box/misc.test.lua +++ b/test/box/misc.test.lua @@ -1,5 +1,5 @@ space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) -- Test Lua from admin console. Whenever producing output, -- make sure it's a valid YAML. diff --git a/test/box/on_replace.result b/test/box/on_replace.result index 3de8a9e9edc2f0e325116e016d017b02f12d165b..c5295f375047c923dc224e8a8aaa0beb613e0342 100644 --- a/test/box/on_replace.result +++ b/test/box/on_replace.result @@ -1,7 +1,7 @@ ts = box.schema.create_space('test_space') --- ... -ts:create_index('primary', { type = 'hash' }) +ti = ts:create_index('primary', { type = 'hash' }) --- ... type(ts.on_replace) diff --git a/test/box/on_replace.test.lua b/test/box/on_replace.test.lua index 6a79ba6337b24e237ffa776c9ed19ebaa0c5ef76..78ccefb0936e1200c73b5c7befeee509392440ac 100644 --- a/test/box/on_replace.test.lua +++ b/test/box/on_replace.test.lua @@ -1,5 +1,5 @@ ts = box.schema.create_space('test_space') -ts:create_index('primary', { type = 'hash' }) +ti = ts:create_index('primary', { type = 'hash' }) type(ts.on_replace) ts.on_replace() diff --git a/test/box/protocol.result b/test/box/protocol.result index f1e99fccb70c88b6891e9fa4be66a9540d47fd2b..86698ffceaa0bb801cdbf272a034cf0bb31dc237 100644 --- a/test/box/protocol.result +++ b/test/box/protocol.result @@ -7,7 +7,7 @@ box.schema.user.grant('guest', 'read,write,execute', 'universe') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'tree'}) +index = space:create_index('primary', { type = 'tree'}) --- ... for i=1,5 do space:insert{i} end diff --git a/test/box/protocol.test.lua b/test/box/protocol.test.lua index fa75d8d8cd854e8020ccfb2ae59dc567fcd1f6f1..1349541bbcc147ba52d8859e77ca61cf6b14281e 100644 --- a/test/box/protocol.test.lua +++ b/test/box/protocol.test.lua @@ -5,7 +5,7 @@ box.schema.user.grant('guest', 'read,write,execute', 'universe') -------------------------------------------------------------------------------- space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'tree'}) +index = space:create_index('primary', { type = 'tree'}) for i=1,5 do space:insert{i} end LISTEN = require('uri').parse(box.cfg.listen) diff --git a/test/box/reconfigure.result b/test/box/reconfigure.result index 17d1412ebaef603869400ed0cccc5da9ed9e068c..048460b37e87479d4435a3e377120dda8f7e7a0f 100644 --- a/test/box/reconfigure.result +++ b/test/box/reconfigure.result @@ -36,7 +36,7 @@ box.cfg.io_collect_interval space = box.schema.create_space('tweedledum', { id = 0 }) --- ... -space:create_index('primary', { type = 'hash'}) +index = space:create_index('primary', { type = 'hash'}) --- ... space:insert{1, 'tuple'} diff --git a/test/box/reconfigure.test.lua b/test/box/reconfigure.test.lua index 236b5de8688a3d397e04d0a6de91fa0792778453..9c607b95099423ea730cbc76b7a647cc0bd82215 100644 --- a/test/box/reconfigure.test.lua +++ b/test/box/reconfigure.test.lua @@ -14,7 +14,7 @@ box.cfg.io_collect_interval -- configuration' -- space = box.schema.create_space('tweedledum', { id = 0 }) -space:create_index('primary', { type = 'hash'}) +index = space:create_index('primary', { type = 'hash'}) space:insert{1, 'tuple'} box.snapshot() box.cfg{} diff --git a/test/box/schema.result b/test/box/schema.result index 6a658d3f0c727fca7b2f6a0295bf92f45e104053..02aa15cd96aae2172075f5259c97272784a6efd6 100644 --- a/test/box/schema.result +++ b/test/box/schema.result @@ -1,7 +1,7 @@ space = box.schema.create_space('tweedledum', { id = 0 }) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end diff --git a/test/box/schema.test.lua b/test/box/schema.test.lua index 9e589c1a24f032dd7c6a5ca620b006dfd3d60497..0c72916a1d2ebc2151d8af82f2598f768b06e93a 100644 --- a/test/box/schema.test.lua +++ b/test/box/schema.test.lua @@ -1,5 +1,5 @@ space = box.schema.create_space('tweedledum', { id = 0 }) -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end t diff --git a/test/box/select.result b/test/box/select.result index 9165a6e00019663278f530669fe6c2c5cb558cbf..82fa43b53777d292e62d6c1ebd6b6cd9526bfa2c 100644 --- a/test/box/select.result +++ b/test/box/select.result @@ -1,10 +1,10 @@ s = box.schema.create_space('select', { temporary = true }) --- ... -index = s:create_index('primary', { type = 'tree' }) +index1 = s:create_index('primary', { type = 'tree' }) --- ... -s:create_index('second', { type = 'tree', unique = true, parts = {2, 'num', 1, 'num'}}) +index2 = s:create_index('second', { type = 'tree', unique = true, parts = {2, 'num', 1, 'num'}}) --- ... for i = 1, 20 do s:insert({ i, 1, 2, 3 }) end @@ -541,7 +541,7 @@ s:drop() s = box.schema.create_space('select', { temporary = true }) --- ... -s:create_index('primary', { type = 'tree' }) +index = s:create_index('primary', { type = 'tree' }) --- ... local a s:insert{0} diff --git a/test/box/select.test.lua b/test/box/select.test.lua index 385a3c295bbec59e7f2b9ded48f92eacf18ea515..cb30b6c4cc607880c4210ba0a3ed00eeb88a4122 100644 --- a/test/box/select.test.lua +++ b/test/box/select.test.lua @@ -1,6 +1,6 @@ s = box.schema.create_space('select', { temporary = true }) -index = s:create_index('primary', { type = 'tree' }) -s:create_index('second', { type = 'tree', unique = true, parts = {2, 'num', 1, 'num'}}) +index1 = s:create_index('primary', { type = 'tree' }) +index2 = s:create_index('second', { type = 'tree', unique = true, parts = {2, 'num', 1, 'num'}}) for i = 1, 20 do s:insert({ i, 1, 2, 3 }) end -------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ s:select(2) s:drop() s = box.schema.create_space('select', { temporary = true }) -s:create_index('primary', { type = 'tree' }) +index = s:create_index('primary', { type = 'tree' }) local a s:insert{0} lots_of_links = {} ref_count = 0 diff --git a/test/box/session.result b/test/box/session.result index 96469ca9389aae39fe99580b2ec388a3bc57bc05..a087de691b433742a6ee07ff1ef498d1a00e1957 100644 --- a/test/box/session.result +++ b/test/box/session.result @@ -7,7 +7,7 @@ fiber = require('fiber') space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... session.exists(session.id()) diff --git a/test/box/session.test.lua b/test/box/session.test.lua index 95152624feb1015433c4c135a6500a97510228ed..da1bc63e8d42ef24ae9200e76fc632f8edbe39e6 100644 --- a/test/box/session.test.lua +++ b/test/box/session.test.lua @@ -2,7 +2,7 @@ session = box.session fiber = require('fiber') space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) session.exists(session.id()) session.peer(session.id()) diff --git a/test/box/snapshot.result b/test/box/snapshot.result index 536a00b789d176afd9675f6dcf87a118b11bc87e..b5920d412146ca26aa0b91a9d9ee74f4d716c377 100644 --- a/test/box/snapshot.result +++ b/test/box/snapshot.result @@ -1,7 +1,7 @@ space = box.schema.create_space('tweedledum', { id = 0 }) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... # diff --git a/test/box/snapshot.test.py b/test/box/snapshot.test.py index f7f66c6c930ed819532cfbe2465edf8793627d4b..cdcbbdfe3caf52963aee6d092f09daeb897c2d23 100644 --- a/test/box/snapshot.test.py +++ b/test/box/snapshot.test.py @@ -4,7 +4,7 @@ import time from signal import SIGUSR1 admin("space = box.schema.create_space('tweedledum', { id = 0 })") -admin("space:create_index('primary', { type = 'hash' })") +admin("index = space:create_index('primary', { type = 'hash' })") print """# # A test case for: http://bugs.launchpad.net/bugs/686411 diff --git a/test/box/snapshot_daemon.result b/test/box/snapshot_daemon.result index 57e0fd3d52964518cf632195051ce6f36021c963..95aa45ff93a1b86a481d0933c154bb0ba9ad6216 100644 --- a/test/box/snapshot_daemon.result +++ b/test/box/snapshot_daemon.result @@ -46,7 +46,7 @@ end space = box.schema.create_space('snapshot_daemon') --- ... -space:create_index('pk', { type = 'tree', parts = { 1, 'num' }}) +index = space:create_index('pk', { type = 'tree', parts = { 1, 'num' }}) --- ... box.cfg{snapshot_period = PERIOD, snapshot_count = 2 } diff --git a/test/box/snapshot_daemon.test.lua b/test/box/snapshot_daemon.test.lua index 45aeb441fc5981d1527210571af289b486396613..d81104d26c81ff694c130b9350efd14c924171a3 100644 --- a/test/box/snapshot_daemon.test.lua +++ b/test/box/snapshot_daemon.test.lua @@ -24,7 +24,7 @@ end space = box.schema.create_space('snapshot_daemon') -space:create_index('pk', { type = 'tree', parts = { 1, 'num' }}) +index = space:create_index('pk', { type = 'tree', parts = { 1, 'num' }}) box.cfg{snapshot_period = PERIOD, snapshot_count = 2 } diff --git a/test/box/sql.result b/test/box/sql.result index cd40f5349dea5e2321d31a20ee043b4966752c6a..9c1c375829e19b4d40aaba65013fd1306a8d6199 100644 --- a/test/box/sql.result +++ b/test/box/sql.result @@ -16,7 +16,7 @@ box.schema.user.grant('test', 'Execute', 'function', 'f') call f() --- ... -box.space.test:create_index('primary', { type = 'hash' }) +index = box.space.test:create_index('primary', { type = 'hash' }) --- ... ping diff --git a/test/box/sql.test.py b/test/box/sql.test.py index 77a7698a70a1c974c4be19efa2beb2bdd3014e6b..2dfd8a6515167a6145539102b96f20a02414b7c1 100644 --- a/test/box/sql.test.py +++ b/test/box/sql.test.py @@ -8,7 +8,7 @@ admin("box.schema.user.grant('test', 'Execute', 'function', 'f')") sql.authenticate('test', 'test') # call from sql to have the right owner sql("call f()") -admin("box.space.test:create_index('primary', { type = 'hash' })") +admin("index = box.space.test:create_index('primary', { type = 'hash' })") sql("ping") # xxx: bug -- currently selects no rows sql("select * from t0") diff --git a/test/box/stat.result b/test/box/stat.result index 9a7d80f3ec8bc3c7ca54e63c41ba464e648c2433..573b5b2cf6ebf3b37ca94a6ffa0c107d88ab85ef 100644 --- a/test/box/stat.result +++ b/test/box/stat.result @@ -24,7 +24,7 @@ box.stat.SELECT.total space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... -- check stat_cleanup diff --git a/test/box/stat.test.lua b/test/box/stat.test.lua index d27662d6aea73d6912bcca155a86aecf73b31a78..d25a67e22f2c6d04303d932a2d2bae44f408b7c4 100644 --- a/test/box/stat.test.lua +++ b/test/box/stat.test.lua @@ -8,7 +8,7 @@ box.stat.REPLACE.total box.stat.SELECT.total space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) -- check stat_cleanup -- add several tuples diff --git a/test/box/temp_spaces.result b/test/box/temp_spaces.result index 640f872956238fdffe4d8ebf6b3b92facbe93442..16b1a4b8677257ea3486e3c5ec461e2d31347aa3 100644 --- a/test/box/temp_spaces.result +++ b/test/box/temp_spaces.result @@ -38,7 +38,7 @@ s:drop() s = box.schema.create_space('t', { temporary = true }) --- ... -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) --- ... s:insert{1, 2, 3} diff --git a/test/box/temp_spaces.test.lua b/test/box/temp_spaces.test.lua index 82e4953fd05227aa035fbfc3d3db6560104a0a5f..bc4961a90415b649d623c9aa9ce8f4e1ab453d86 100644 --- a/test/box/temp_spaces.test.lua +++ b/test/box/temp_spaces.test.lua @@ -16,7 +16,7 @@ s.temporary s:drop() s = box.schema.create_space('t', { temporary = true }) -s:create_index('primary', { type = 'hash' }) +index = s:create_index('primary', { type = 'hash' }) s:insert{1, 2, 3} s:get{1} diff --git a/test/box/transaction.result b/test/box/transaction.result index c8b38ae3a6d6080bdf8a0e93ef71aa8fa246504d..6cfc1893e80a4d33b02a17f28b29ef46f8bf0d42 100644 --- a/test/box/transaction.result +++ b/test/box/transaction.result @@ -107,14 +107,14 @@ box.rollback(); s = box.schema.space.create('test'); --- ... -box.begin() s:create_index('primary'); +box.begin() index = s:create_index('primary'); --- - error: Space _index does not support multi-statement transactions ... box.rollback(); --- ... -s:create_index('primary'); +index = s:create_index('primary'); --- ... function multi() @@ -264,7 +264,7 @@ s:drop(); tester = box.schema.create_space('tester') --- ... -tester:create_index('primary') +tindex = tester:create_index('primary') --- ... box.begin() tester:insert{1} box.rollback() diff --git a/test/box/transaction.test.lua b/test/box/transaction.test.lua index 341b1eea65bd125148e73b17f6ba2e4d06a2b10e..c49152234ddad1b549e5c021b0102d70d512da2a 100644 --- a/test/box/transaction.test.lua +++ b/test/box/transaction.test.lua @@ -42,9 +42,9 @@ box.rollback(); box.begin() box.space._cluster:insert{123456789, 'abc'}; box.rollback(); s = box.schema.space.create('test'); -box.begin() s:create_index('primary'); +box.begin() index = s:create_index('primary'); box.rollback(); -s:create_index('primary'); +index = s:create_index('primary'); function multi() box.begin() s:auto_increment{'first row'} @@ -122,7 +122,7 @@ s:select{}; s:drop(); --# setopt delimiter '' tester = box.schema.create_space('tester') -tester:create_index('primary') +tindex = tester:create_index('primary') box.begin() tester:insert{1} box.rollback() tester:select{1} box.begin() tester:insert{1} box.commit() diff --git a/test/box/tuple.result b/test/box/tuple.result index 975be871b5ce53c4f92baf19cc6e47b17f4af263..08db8a8078a3e7da70afa3ab1b159944d26297a0 100644 --- a/test/box/tuple.result +++ b/test/box/tuple.result @@ -260,7 +260,7 @@ getmetatable(box.tuple.new{1, 2, 3}:totable()) space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary') +index = space:create_index('primary') --- ... space:truncate() diff --git a/test/box/tuple.test.lua b/test/box/tuple.test.lua index cb8f126f3d96ffd141119d63a28a4cac81b72d6f..f5161f58ecdf4a6b701c57c5b372ff1f76b4353f 100644 --- a/test/box/tuple.test.lua +++ b/test/box/tuple.test.lua @@ -81,7 +81,7 @@ getmetatable(box.tuple.new{1, 2, 3}:totable()) -- A test case for the key as an tuple space = box.schema.create_space('tweedledum') -space:create_index('primary') +index = space:create_index('primary') space:truncate() t=space:insert{0, 777, '0', '1', '2', '3'} t diff --git a/test/box/update.result b/test/box/update.result index b2b49e328484118f8bc65f7d4222f463e871c4fe..682e25b1ede18357b39b22273c7a41546d7861c4 100644 --- a/test/box/update.result +++ b/test/box/update.result @@ -1,7 +1,7 @@ s = box.schema.create_space('tweedledum') --- ... -s:create_index('pk') +index = s:create_index('pk') --- ... -- test delete field @@ -334,7 +334,7 @@ s:drop() s = box.schema.create_space('tweedledum') --- ... -s:create_index('pk') +index = s:create_index('pk') --- ... s:insert{1, 2, 3} diff --git a/test/box/update.test.lua b/test/box/update.test.lua index 010721ce170bed04660c16ed85d7e2a84c153bb4..4c480a90d3662fcb33a4a209d65a14d750b12cd9 100644 --- a/test/box/update.test.lua +++ b/test/box/update.test.lua @@ -1,5 +1,5 @@ s = box.schema.create_space('tweedledum') -s:create_index('pk') +index = s:create_index('pk') -- test delete field s:insert{1000001, 1000002, 1000003, 1000004, 1000005} @@ -113,7 +113,7 @@ s:drop() -- #521: Cryptic error message in update operation s = box.schema.create_space('tweedledum') -s:create_index('pk') +index = s:create_index('pk') s:insert{1, 2, 3} s:update({1}) s:update({1}, {'=', 1, 1}) diff --git a/test/box/xlog.result b/test/box/xlog.result index 2cbf8cb9d5500721a5cbb6a9572cdd0d6440312d..89a982a4ba0195c13f884d8f09b9054772237a0e 100644 --- a/test/box/xlog.result +++ b/test/box/xlog.result @@ -5,7 +5,7 @@ space = box.schema.create_space('tweedledum', { id = 0 }) --- ... .xlog.inprogress exists -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... .xlog.inprogress has been successfully renamed @@ -34,7 +34,7 @@ box.space[0]:insert{5, 'Unfinished record'} space = box.schema.create_space('test') --- ... -box.space['test']:create_index('primary') +index = box.space['test']:create_index('primary') --- ... box.space['test']:insert{1, 'first tuple'} @@ -49,7 +49,7 @@ box.space['test']:insert{2, 'second tuple'} space = box.schema.create_space('test') --- ... -box.space['test']:create_index('primary') +index = box.space['test']:create_index('primary') --- ... box.space['test']:insert{1, 'first tuple'} @@ -88,7 +88,7 @@ box.space['test']:len() space = box.schema.create_space('test') --- ... -box.space.test:create_index('primary') +index = box.space.test:create_index('primary') --- ... box.space.test:insert{1, 'first tuple'} diff --git a/test/box/xlog.test.py b/test/box/xlog.test.py index 3b93d72c37710cdd2295ed6181b5589b8700b699..6d70d7491574935c1afb785b51dadd798bc57ad3 100644 --- a/test/box/xlog.test.py +++ b/test/box/xlog.test.py @@ -24,7 +24,7 @@ server.admin("space = box.schema.create_space('tweedledum', { id = 0 })") if os.access(wal_inprogress, os.F_OK): print ".xlog.inprogress exists" -server.admin("space:create_index('primary', { type = 'hash' })") +server.admin("index = space:create_index('primary', { type = 'hash' })") if os.access(wal, os.F_OK) and not os.access(wal_inprogress, os.F_OK): print ".xlog.inprogress has been successfully renamed" @@ -145,7 +145,7 @@ wal = os.path.join(server.vardir, filename) # Create wal#1 server.admin("space = box.schema.create_space('test')") -server.admin("box.space['test']:create_index('primary')") +server.admin("index = box.space['test']:create_index('primary')") server.admin("box.space['test']:insert{1, 'first tuple'}") server.admin("box.space['test']:insert{2, 'second tuple'}") server.stop() @@ -160,7 +160,7 @@ lsn += 4 # Create another wal#1 server.start() server.admin("space = box.schema.create_space('test')") -server.admin("box.space['test']:create_index('primary')") +server.admin("index = box.space['test']:create_index('primary')") server.admin("box.space['test']:insert{1, 'first tuple'}") server.admin("box.space['test']:delete{1}") server.stop() @@ -207,7 +207,7 @@ server.deploy() # Create wal#1 server.admin("space = box.schema.create_space('test')") -server.admin("box.space.test:create_index('primary')") +server.admin("index = box.space.test:create_index('primary')") server.admin("box.space.test:insert{1, 'first tuple'}") server.admin("box.space.test:insert{2, 'second tuple'}") lsn = int(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) diff --git a/test/replication/consistent.result b/test/replication/consistent.result index c2bcd55ee174d0a8fcafff8f08b1a6b8e7abac56..a57f992fb11dfe5a0ff344f1cfff13de818ba9c6 100644 --- a/test/replication/consistent.result +++ b/test/replication/consistent.result @@ -60,7 +60,7 @@ a:close() s = box.schema.create_space('tweedledum', {id = 0}); --- ... -s:create_index('primary', {type = 'hash'}) +index = s:create_index('primary', {type = 'hash'}) --- ... _insert(1, 10, 'master') diff --git a/test/replication/consistent.test.lua b/test/replication/consistent.test.lua index a756258b8956bb6857496aac03be510ba6731a4c..06c18ac135729d3f25889ae76cedfa1beac83d2a 100644 --- a/test/replication/consistent.test.lua +++ b/test/replication/consistent.test.lua @@ -44,7 +44,7 @@ a:call('_set_pri_lsn', box.info.lsn) a:close() s = box.schema.create_space('tweedledum', {id = 0}); -s:create_index('primary', {type = 'hash'}) +index = s:create_index('primary', {type = 'hash'}) _insert(1, 10, 'master') _select(1, 10) --# set connection replica diff --git a/test/replication/hot_standby.result b/test/replication/hot_standby.result index d2b066d47a98c1c6fc952afcf7743f088c45fd28..571613664c3a67514da4212971c4ad7dda26e4e3 100644 --- a/test/replication/hot_standby.result +++ b/test/replication/hot_standby.result @@ -84,7 +84,7 @@ a:close() space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... _insert(1, 10) diff --git a/test/replication/hot_standby.test.lua b/test/replication/hot_standby.test.lua index 560207fb6b5dd5f2b9495272dc252a75a29a32f8..655c22652705daf4d5688793466692fa2af3b9b6 100644 --- a/test/replication/hot_standby.test.lua +++ b/test/replication/hot_standby.test.lua @@ -63,7 +63,7 @@ a:call('_set_pri_lsn', box.info.server.id, box.info.server.lsn) a:close() space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) _insert(1, 10) _select(1, 10) diff --git a/test/replication/init_storage.result b/test/replication/init_storage.result index 1e57498026fcc632b019c7eba0d546e8852dc735..a013177fbbf7d1dbe653ab71d39beda3d674174b 100644 --- a/test/replication/init_storage.result +++ b/test/replication/init_storage.result @@ -4,7 +4,7 @@ box.schema.user.grant('guest', 'read,write,execute', 'universe') space = box.schema.create_space('test', {id = 42}) --- ... -space:create_index('primary', { type = 'tree'}) +index = space:create_index('primary', { type = 'tree'}) --- ... for k = 1, 9 do space:insert{k, k*k} end diff --git a/test/replication/init_storage.test.py b/test/replication/init_storage.test.py index e7049c89a2efd78ae4f8d757e38c5ae2a35ad97c..4f6f78a6d0904c434d8f6b3d15b41c3e1a9a7097 100644 --- a/test/replication/init_storage.test.py +++ b/test/replication/init_storage.test.py @@ -8,7 +8,7 @@ master_id = master.get_param('server')['id'] master.admin("box.schema.user.grant('guest', 'read,write,execute', 'universe')") master.admin("space = box.schema.create_space('test', {id = 42})") -master.admin("space:create_index('primary', { type = 'tree'})") +master.admin("index = space:create_index('primary', { type = 'tree'})") master.admin('for k = 1, 9 do space:insert{k, k*k} end') diff --git a/test/replication/swap.result b/test/replication/swap.result index 7264bc985d053c0fb122f80eeda232b9e9e736eb..117f464cec8de76222ce4ce84a5f6a1bdc0c89af 100644 --- a/test/replication/swap.result +++ b/test/replication/swap.result @@ -13,7 +13,7 @@ while box.space['_priv']:len() < 1 do require('fiber').sleep(0.01) end s = box.schema.create_space('tweedledum', {id = 0}) --- ... -s:create_index('primary', {type = 'hash'}) +index = s:create_index('primary', {type = 'hash'}) --- ... test 0 iteration diff --git a/test/replication/swap.test.py b/test/replication/swap.test.py index 74cd85a7b37e7d7042bb79fc03c6f29b04ba8c02..108d7f237b55b731c2573a7e1a833ae5c00e0174 100644 --- a/test/replication/swap.test.py +++ b/test/replication/swap.test.py @@ -37,7 +37,7 @@ replica.admin("while box.space['_priv']:len() < 1 do require('fiber').sleep(0.01 replica.sql.py_con.authenticate(LOGIN, PASSWORD) master.admin("s = box.schema.create_space('tweedledum', {id = 0})") -master.admin("s:create_index('primary', {type = 'hash'})") +master.admin("index = s:create_index('primary', {type = 'hash'})") ### gh-343: replica.cc must not add login and password to proc title #status = replica.get_param("status") diff --git a/test/sophia/crud.result b/test/sophia/crud.result index 52822918ea54bc3c82205c05c31912985589da3d..4ebfdc36ff12cccb294848e0d1c5481e2c8abec3 100644 --- a/test/sophia/crud.result +++ b/test/sophia/crud.result @@ -5,7 +5,7 @@ sophia_rmdir() space = box.schema.create_space('test', { engine = 'sophia', id = 100 }) --- ... -space:create_index('primary', { type = 'tree', parts = {1, 'num'} }) +index = space:create_index('primary', { type = 'tree', parts = {1, 'num'} }) --- ... for key = 1, 132 do space:insert({key}) end diff --git a/test/sophia/crud.test.lua b/test/sophia/crud.test.lua index 191a58057830fb0de8478d8a21cbcf01e88b9e29..39109a25e48094d52724d325c6ebf47b1c0a8c2f 100644 --- a/test/sophia/crud.test.lua +++ b/test/sophia/crud.test.lua @@ -4,7 +4,7 @@ sophia_rmdir() -- insert space = box.schema.create_space('test', { engine = 'sophia', id = 100 }) -space:create_index('primary', { type = 'tree', parts = {1, 'num'} }) +index = space:create_index('primary', { type = 'tree', parts = {1, 'num'} }) for key = 1, 132 do space:insert({key}) end t = {} for key = 1, 132 do table.insert(t, space:get({key})) end diff --git a/test/sophia/dml.result b/test/sophia/dml.result index 69b0f8746bf5b7d9d09d73126652466522b10167..b2a433a2571623120f6daedbbeb28d52ff0fcc1f 100644 --- a/test/sophia/dml.result +++ b/test/sophia/dml.result @@ -20,7 +20,7 @@ sophia_printdir() space = box.schema.create_space('test', { id = 101, engine = 'sophia' }) --- ... -space:create_index('primary') +index = space:create_index('primary') --- ... sophia_printdir() @@ -40,7 +40,7 @@ sophia_printdir() space = box.schema.create_space('test', { id = 102, engine = 'sophia' }) --- ... -space:create_index('primary') +index = space:create_index('primary') --- ... sophia_printdir() @@ -67,7 +67,7 @@ space:drop() space = box.schema.create_space('test', { id = 103, engine = 'sophia' }) --- ... -space:create_index('primary', {type = 'tree', parts = {1, 'STR'}}) +index = space:create_index('primary', {type = 'tree', parts = {1, 'STR'}}) --- ... space:insert({'test'}) @@ -87,7 +87,7 @@ space:drop() space = box.schema.create_space('test', { id = 104, engine = 'sophia' }) --- ... -space:create_index('primary', {type = 'tree', parts = {1, 'num'}}) +index = space:create_index('primary', {type = 'tree', parts = {1, 'num'}}) --- ... space:insert({13}) @@ -107,7 +107,7 @@ space:drop() space = box.schema.create_space('test', { id = 105, engine = 'sophia' }) --- ... -space:create_index('primary', {type = 'hash'}) +index = space:create_index('primary', {type = 'hash'}) --- - error: Unsupported index type supplied for index 0 in space 105 ... @@ -118,10 +118,10 @@ space:drop() space = box.schema.create_space('test', { id = 106, engine = 'sophia' }) --- ... -space:create_index('primary') +index1 = space:create_index('primary') --- ... -space:create_index('secondary') +index2 = space:create_index('secondary') --- - error: 'Can''t create or modify index 1 in space 106: Sophia TREE secondary indexes are not supported' @@ -137,7 +137,7 @@ sophia_printdir() space = box.schema.create_space('test', { id = 107, engine = 'sophia' }) --- ... -space:create_index('primary') +index = space:create_index('primary') --- ... primary = space.index[0] diff --git a/test/sophia/dml.test.lua b/test/sophia/dml.test.lua index 56ca115287d3c6edca13fda99bc4e70c403e45c4..ebd6ce8f64b14953e547ec2bdb6b49d56ad6b80e 100644 --- a/test/sophia/dml.test.lua +++ b/test/sophia/dml.test.lua @@ -11,7 +11,7 @@ sophia_printdir() -- index create/drop space = box.schema.create_space('test', { id = 101, engine = 'sophia' }) -space:create_index('primary') +index = space:create_index('primary') sophia_printdir() space:drop() sophia_printdir() @@ -19,7 +19,7 @@ sophia_printdir() -- index create/drop alter space = box.schema.create_space('test', { id = 102, engine = 'sophia' }) -space:create_index('primary') +index = space:create_index('primary') sophia_printdir() _index = box.space[box.schema.INDEX_ID] _index:delete{102, 0} @@ -29,7 +29,7 @@ space:drop() -- index create/drop tree string space = box.schema.create_space('test', { id = 103, engine = 'sophia' }) -space:create_index('primary', {type = 'tree', parts = {1, 'STR'}}) +index = space:create_index('primary', {type = 'tree', parts = {1, 'STR'}}) space:insert({'test'}) sophia_printdir() space:drop() @@ -37,7 +37,7 @@ space:drop() -- index create/drop tree num space = box.schema.create_space('test', { id = 104, engine = 'sophia' }) -space:create_index('primary', {type = 'tree', parts = {1, 'num'}}) +index = space:create_index('primary', {type = 'tree', parts = {1, 'num'}}) space:insert({13}) sophia_printdir() space:drop() @@ -45,21 +45,21 @@ space:drop() -- index create hash space = box.schema.create_space('test', { id = 105, engine = 'sophia' }) -space:create_index('primary', {type = 'hash'}) +index = space:create_index('primary', {type = 'hash'}) space:drop() -- secondary index create space = box.schema.create_space('test', { id = 106, engine = 'sophia' }) -space:create_index('primary') -space:create_index('secondary') +index1 = space:create_index('primary') +index2 = space:create_index('secondary') space:drop() sophia_printdir() -- index size space = box.schema.create_space('test', { id = 107, engine = 'sophia' }) -space:create_index('primary') +index = space:create_index('primary') primary = space.index[0] primary:len() space:insert({13}) diff --git a/test/sophia/gh.result b/test/sophia/gh.result index 7debe9511955e359d13fe24eb09354eca7aebd68..d393238be546719c9f196d9479ed0ab3f45fbdf0 100644 --- a/test/sophia/gh.result +++ b/test/sophia/gh.result @@ -70,7 +70,7 @@ s:drop() s = box.schema.create_space('tester',{engine='sophia'}) --- ... -s:create_index('sophia_index', {}) +i = s:create_index('sophia_index', {}) --- ... s:insert{10000, 'Hilton'} @@ -103,7 +103,7 @@ s = box.schema.create_space('tester',{engine='sophia', temporary=true}) s = box.schema.create_space('tester',{id = 89, engine='sophia'}) --- ... -s:create_index('sophia_index', {}) +i = s:create_index('sophia_index', {}) --- ... for v=1, 100 do s:insert({v}) end @@ -130,7 +130,7 @@ s:drop() s = box.schema.create_space('tester', {id = 90, engine='sophia'}) --- ... -s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}}) +i = s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}}) --- ... for v=1, 100 do s:insert({tostring(v)}) end diff --git a/test/sophia/gh.test.lua b/test/sophia/gh.test.lua index 790863b4d17aee01ae13a365d1f4ff4f0924de0f..4f01d2349000e586ff23096e277fab329fd713f0 100644 --- a/test/sophia/gh.test.lua +++ b/test/sophia/gh.test.lua @@ -31,7 +31,7 @@ s:drop() -- gh-431: Sophia: assertion if box.begin s = box.schema.create_space('tester',{engine='sophia'}) -s:create_index('sophia_index', {}) +i = s:create_index('sophia_index', {}) s:insert{10000, 'Hilton'} box.begin() s:delete{10000} -- exception @@ -46,7 +46,7 @@ s = box.schema.create_space('tester',{engine='sophia', temporary=true}) -- gh-432: Sophia: ignored limit s = box.schema.create_space('tester',{id = 89, engine='sophia'}) -s:create_index('sophia_index', {}) +i = s:create_index('sophia_index', {}) for v=1, 100 do s:insert({v}) end t = s:select({''},{iterator='GT', limit =1}) t @@ -55,7 +55,7 @@ t s:drop() s = box.schema.create_space('tester', {id = 90, engine='sophia'}) -s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}}) +i = s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}}) for v=1, 100 do s:insert({tostring(v)}) end t = s:select({''},{iterator='GT', limit =1}) t diff --git a/test/sophia/recover.result b/test/sophia/recover.result index 4903baa4388743108b9dc90789309e54c050a27b..f162a5564482678cc81f37a577fafe153222d831 100644 --- a/test/sophia/recover.result +++ b/test/sophia/recover.result @@ -5,7 +5,7 @@ sophia_rmdir() space = box.schema.create_space('test', { id = 100, engine = 'sophia' }) --- ... -space:create_index('primary') +index = space:create_index('primary') --- ... sophia_printdir() diff --git a/test/sophia/recover.test.lua b/test/sophia/recover.test.lua index ffea2d43ca920888f7cbd065477306ab3d28ab6e..a62d2172d1b95d3f41221d51bd19d070eee185bd 100644 --- a/test/sophia/recover.test.lua +++ b/test/sophia/recover.test.lua @@ -4,7 +4,7 @@ sophia_rmdir() -- snapshot space = box.schema.create_space('test', { id = 100, engine = 'sophia' }) -space:create_index('primary') +index = space:create_index('primary') sophia_printdir() box.snapshot() space:drop() diff --git a/test/wal/lua.result b/test/wal/lua.result index 6bd2c18bfea920e0f310db3f2ce6956b745352c3..07d561f99873b4ec8938e9a6e8c87fd05f92d52a 100644 --- a/test/wal/lua.result +++ b/test/wal/lua.result @@ -1,10 +1,10 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type ='hash', parts = {1, 'str'}, unique = true }) +index1 = space:create_index('primary', { type ='hash', parts = {1, 'str'}, unique = true }) --- ... -space:create_index('secondary', { type = 'tree', parts = {2, 'num'}, unique = false }) +index2 = space:create_index('secondary', { type = 'tree', parts = {2, 'num'}, unique = false }) --- ... -- A test case for Bug#1042738 @@ -50,7 +50,7 @@ space:drop() space = box.schema.create_space('tweedledum', {id=0}) --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... --# setopt delimiter ';' diff --git a/test/wal/lua.test.lua b/test/wal/lua.test.lua index c137b6bb2a05f1742056b5f8bcaddd5c64aaa320..28b6e29752602cc73e8ceb5e3064137cf334e975 100644 --- a/test/wal/lua.test.lua +++ b/test/wal/lua.test.lua @@ -1,6 +1,6 @@ space = box.schema.create_space('tweedledum') -space:create_index('primary', { type ='hash', parts = {1, 'str'}, unique = true }) -space:create_index('secondary', { type = 'tree', parts = {2, 'num'}, unique = false }) +index1 = space:create_index('primary', { type ='hash', parts = {1, 'str'}, unique = true }) +index2 = space:create_index('secondary', { type = 'tree', parts = {2, 'num'}, unique = false }) -- A test case for Bug#1042738 -- https://bugs.launchpad.net/tarantool/+bug/1042738 -- Iteration over a non-unique TREE index @@ -35,7 +35,7 @@ space:drop() -- Space does not exist error on repetitive access to space 0 in Lua -- space = box.schema.create_space('tweedledum', {id=0}) -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --# setopt delimiter ';' function mktuple(n) diff --git a/test/wal/oom.result b/test/wal/oom.result index 089a7c863cee3698aad087f5e4726a1ced3fe041..4a27adc6142d909ce5bc7ab0aa724603b1a67b07 100644 --- a/test/wal/oom.result +++ b/test/wal/oom.result @@ -3,7 +3,7 @@ space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... --# setopt delimiter ';' diff --git a/test/wal/oom.test.lua b/test/wal/oom.test.lua index 586b05f9671dbe12224298fd97e451f15a5ac109..160390a8c5770bb661bbcf2a3d4d6e8054eaf83a 100644 --- a/test/wal/oom.test.lua +++ b/test/wal/oom.test.lua @@ -1,7 +1,7 @@ --# stop server default --# start server default space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --# setopt delimiter ';' i = 1; while true do diff --git a/test/wal/tuple.result b/test/wal/tuple.result index fda61d9397f6253d9e4a02ffc699499b5c031130..26d6507f8f4c82b30899c4073c49e5950781ff1f 100644 --- a/test/wal/tuple.result +++ b/test/wal/tuple.result @@ -10,7 +10,7 @@ tester = box.schema.create_space('tester') --- ... -tester:create_index('primary',{}) +index = tester:create_index('primary',{}) --- ... --# setopt delimiter ';' diff --git a/test/wal/tuple.test.lua b/test/wal/tuple.test.lua index af1a13193f1d69095a86e2c4ce2aac29862b3339..9965eb3090209d49cb45a183cd9efd380526eb3d 100644 --- a/test/wal/tuple.test.lua +++ b/test/wal/tuple.test.lua @@ -8,7 +8,7 @@ -- large tables -- ------------------------------------------------------- tester = box.schema.create_space('tester') -tester:create_index('primary',{}) +index = tester:create_index('primary',{}) --# setopt delimiter ';' function tuple_max() local n = 'a' diff --git a/test/wal/wal_mode.result b/test/wal/wal_mode.result index 5e6f49f044e58952f226c02d857723826c26504c..07f5870879612415504e5c7d1bc42767220c85bc 100644 --- a/test/wal/wal_mode.result +++ b/test/wal/wal_mode.result @@ -5,7 +5,7 @@ box.cfg.wal_mode space = box.schema.create_space('tweedledum') --- ... -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) --- ... space:insert{1} diff --git a/test/wal/wal_mode.test.lua b/test/wal/wal_mode.test.lua index 4fad8a33e751d19b3763591f129db3c7c4c98992..14a022b3f97e19b350edb1f1a3e2bbaa2c11a0f7 100644 --- a/test/wal/wal_mode.test.lua +++ b/test/wal/wal_mode.test.lua @@ -1,6 +1,6 @@ box.cfg.wal_mode space = box.schema.create_space('tweedledum') -space:create_index('primary', { type = 'hash' }) +index = space:create_index('primary', { type = 'hash' }) space:insert{1} space:insert{2} space:insert{3}