diff --git a/src/box/index.h b/src/box/index.h index 9129c83e545cb9aa8b9aa881ea6c919bd240686e..4262b2dfbed4bc12f1b5e6b481f363bf903f6db1 100644 --- a/src/box/index.h +++ b/src/box/index.h @@ -59,9 +59,10 @@ struct tuple; * For ITER_EQ, the key must not be NULL. */ #define ITERATOR_TYPE(_) \ - _(ITER_ALL, 0) /* all tuples */ \ - _(ITER_EQ, 1) /* key == x ASC order */ \ - _(ITER_REQ, 2) /* key == x DESC order */ \ + /* ITER_EQ must be the first member for request_create */ \ + _(ITER_EQ, 0) /* key == x ASC order */ \ + _(ITER_REQ, 1) /* key == x DESC order */ \ + _(ITER_ALL, 2) /* all tuples */ \ _(ITER_LT, 3) /* key < x */ \ _(ITER_LE, 4) /* key <= x */ \ _(ITER_GE, 5) /* key >= x */ \ diff --git a/src/box/lua/box_net.lua b/src/box/lua/box_net.lua index 2c7ce7b7c8b744c0a61bb392943626438e58abc9..3f81b56923453e6ed3a0d8a3ccf5f6d28371a49e 100644 --- a/src/box/lua/box_net.lua +++ b/src/box/lua/box_net.lua @@ -149,9 +149,59 @@ box.net = { end end, - select = function(self, space, key) - -- unpack - is old behaviour - return unpack(self:eselect(space, 0, key, { limit = 4294967295 })) + get = function(self, space, key) + key = keify(key) + local result = self:process(box.net.box.SELECT, + msgpack.encode({ + [box.net.box.SPACE_ID] = space, + [box.net.box.KEY] = key, + [box.net.box.ITERATOR] = box.index.EQ, + [box.net.box.OFFSET] = 0, + [box.net.box.LIMIT] = 2 + })) + if #result == 0 then + return + elseif #result == 1 then + return result[1] + else + box.raise(box.error.ER_MORE_THAN_ONE_TUPLE, + "More than one tuple found without 'limit'") + end + end, + + select = function(self, space, key, opts) + local offset = 0 + local limit = 4294967295 + local iterator = box.index.EQ + + key = keify(key) + if #key == 0 then + iterator = box.index.ALL + end + + if opts ~= nil then + if opts.offset ~= nil then + offset = tonumber(opts.offset) + end + if type(opts.iterator) == "string" then + opts.iterator = box.index[opts.iterator] + end + if opts.iterator ~= nil then + iterator = tonumber(opts.iterator) + end + if opts.limit ~= nil then + limit = tonumber(opts.limit) + end + end + local result = self:process(box.net.box.SELECT, + msgpack.encode({ + [box.net.box.SPACE_ID] = space, + [box.net.box.KEY] = key, + [box.net.box.ITERATOR] = iterator, + [box.net.box.OFFSET] = offset, + [box.net.box.LIMIT] = limit + })) + return result end, ping = function(self) @@ -258,6 +308,8 @@ box.net = { } } +box.net.box.put = box.net.box.replace; -- put is an alias for replace + -- box.net.self rpc works like remote.rpc box.net.self.rpc = { r = box.net.self } setmetatable(box.net.self.rpc, { __index = rpc_index }) diff --git a/src/box/lua/call.cc b/src/box/lua/call.cc index 2e1d3ac95a5e622033271ba12f32de5b4219e384..f28d63e4c6843359242df8006a2aeb1ba2838aac 100644 --- a/src/box/lua/call.cc +++ b/src/box/lua/call.cc @@ -266,17 +266,23 @@ lbox_request_create(struct lua_State *L, enum iproto_request_type type, static int lbox_select(lua_State *L) { - if (lua_gettop(L) != 3 || ! lua_isnumber(L, 1) || - ! lua_isnumber(L, 2)) { - return luaL_error(L, "Usage index:select(key)"); + if (lua_gettop(L) != 6 || !lua_isnumber(L, 1) || !lua_isnumber(L, 2) || + !lua_isnumber(L, 4) || !lua_isnumber(L, 5) || !lua_isnumber(L, 6)) { + return luaL_error(L, "Usage index:select(key, " + "iterator, offset, limit)"); } + RegionGuard region_guard(&fiber()->gc); struct request *request = lbox_request_create(L, IPROTO_SELECT, 3, -1); request->index_id = lua_tointeger(L, 2); - request->limit = 4294967295; - box_process(port_lua_create(L), request); - return lua_gettop(L) - 3; + request->iterator = lua_tointeger(L, 4); + request->offset = lua_tointeger(L, 5); + request->limit = lua_tointeger(L, 6); + + lua_newtable(L); + box_process(port_lua_process_create(L), request); + return 1; } static int diff --git a/src/box/lua/misc.lua b/src/box/lua/misc.lua index 107e0bc89589f734a26d2cb9d69c06068854126a..b9172b05f7fa933283a95f970df5445303e75748 100644 --- a/src/box/lua/misc.lua +++ b/src/box/lua/misc.lua @@ -35,7 +35,7 @@ function box.counter.dec(spaceno, key) local cnt_index = #key local s = box.space[spaceno] - local tuple = s:select(key) + local tuple = s:get(key) if tuple == nil then return 0 end if tuple[cnt_index] == 1 then s:delete(key) diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua index f8f031d73cfd38bc805ee8170c981e7bffecb030..10c0cf74c9354ed53df76ad9d7d4303b940c1ec2 100644 --- a/src/box/lua/schema.lua +++ b/src/box/lua/schema.lua @@ -55,7 +55,7 @@ box.schema.create_space = box.schema.space.create box.schema.space.drop = function(space_id) local _space = box.space[box.schema.SPACE_ID] local _index = box.space[box.schema.INDEX_ID] - local keys = { _index:select{space_id} } + local keys = _index:select(space_id) for i = #keys, 1, -1 do local v = keys[i] _index:delete{v[0], v[1]} @@ -157,7 +157,7 @@ box.schema.index.alter = function(space_id, index_id, options) _index:update({space_id, index_id}, ops) return end - local tuple = _index:select{space_id, index_id} + local tuple = _index:get{space_id, index_id} if options.name == nil then options.name = tuple[2] end @@ -266,7 +266,7 @@ function box.schema.space.bless(space) index_mt.count = function(index, key, opts) local count = 0 local iterator - + if opts and opts.iterator ~= nil then iterator = opts.iterator else @@ -356,9 +356,45 @@ function box.schema.space.bless(space) return result end - -- - index_mt.select = function(index, key) - return box._select(index.n, index.id, keify(key)) + index_mt.get = function(index, key) + key = keify(key) + local result = box._select(index.n, index.id, key, box.index.EQ, 0, 2) + if #result == 0 then + return + elseif #result == 1 then + return result[1] + else + box.raise(box.error.ER_MORE_THAN_ONE_TUPLE, + "More than one tuple found by get()") + end + end + + index_mt.select = function(index, key, opts) + local offset = 0 + local limit = 4294967295 + local iterator = box.index.EQ + + key = keify(key) + if #key == 0 then + iterator = box.index.ALL + end + + if opts ~= nil then + if opts.offset ~= nil then + offset = tonumber(opts.offset) + end + if type(opts.iterator) == "string" then + opts.iterator = box.index[opts.iterator] + end + if opts.iterator ~= nil then + iterator = tonumber(opts.iterator) + end + if opts.limit ~= nil then + limit = tonumber(opts.limit) + end + end + + return box._select(index.n, index.id, key, iterator, offset, limit) end index_mt.update = function(index, key, ops) return box._update(index.n, index.id, keify(key), ops); @@ -384,10 +420,13 @@ function box.schema.space.bless(space) check_index(space, 0) return space.index[0]:eselect(key, opts) end - - space_mt.select = function(space, key) + space_mt.get = function(space, key) + check_index(space, 0) + return space.index[0]:get(key) + end + space_mt.select = function(space, key, opts) check_index(space, 0) - return space.index[0]:select(key) + return space.index[0]:select(key, opts) end space_mt.insert = function(space, tuple) return box._insert(space.n, tuple); @@ -395,6 +434,7 @@ function box.schema.space.bless(space) space_mt.replace = function(space, tuple) return box._replace(space.n, tuple); end + space_mt.put = space_mt.replace; -- put is an alias for replace space_mt.update = function(space, key, ops) check_index(space, 0) return space.index[0]:update(key, ops) diff --git a/src/box/request.cc b/src/box/request.cc index 230942762c34eb92eda903a6e2973a2f3b5fa762..a22c569d25ec91d8253998b8136c91b81897e0af 100644 --- a/src/box/request.cc +++ b/src/box/request.cc @@ -138,13 +138,16 @@ execute_select(struct request *request, struct txn *txn, struct port *port) uint32_t found = 0; uint32_t offset = request->offset; uint32_t limit = request->limit; + if (request->iterator >= iterator_type_MAX) + tnt_raise(IllegalParams, "Invalid iterator type"); + enum iterator_type type = (enum iterator_type) request->iterator; const char *key = request->key; uint32_t part_count = mp_decode_array(&key); struct iterator *it = index->position(); - key_validate(index->key_def, ITER_EQ, key, part_count); - index->initIterator(it, ITER_EQ, key, part_count); + key_validate(index->key_def, type, key, part_count); + index->initIterator(it, type, key, part_count); struct tuple *tuple; while ((tuple = it->next(it)) != NULL) { @@ -236,6 +239,9 @@ request_decode(struct request *request, const char *data, uint32_t len) case IPROTO_LIMIT: request->limit = mp_decode_uint(&value); break; + case IPROTO_ITERATOR: + request->iterator = mp_decode_uint(&value); + break; case IPROTO_TUPLE: request->tuple = value; request->tuple_end = data; diff --git a/src/box/request.h b/src/box/request.h index 6b7b40600e5be38a2cfb41a1b2177a31b46265bb..e87a46c4c918a273323b8d3b87ccd1a4e74cec72 100644 --- a/src/box/request.h +++ b/src/box/request.h @@ -45,6 +45,7 @@ struct request uint32_t index_id; uint32_t offset; uint32_t limit; + uint32_t iterator; /* Search key or proc name. */ const char *key; const char *key_end; diff --git a/test/big/hash.result b/test/big/hash.result index ba6fa5c6a75d79bdfff7e59d42586834eab6d218..bc5e1f5878706c16cc31db984656d4eaa111c15f 100644 --- a/test/big/hash.result +++ b/test/big/hash.result @@ -60,34 +60,34 @@ hash:replace{'invalid key', 'value1 v1.0', 'value2 v1.0'} -- 32-bit hash select fields test ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{0} +hash.index['primary']:get{0} --- - [0, 'value1 v1.0', 'value2 v1.0'] ... -hash.index['primary']:select{1} +hash.index['primary']:get{1} --- - [1, 'value1 v1.32', 'value2 1.72'] ... -hash.index['primary']:select{2} +hash.index['primary']:get{2} --- - [2, 'value1 v1.43', 'value2 1.92'] ... -hash.index['primary']:select{3} +hash.index['primary']:get{3} --- - [3, 'value1 v1.31', 'value2 1.12'] ... -hash.index['primary']:select{4} +hash.index['primary']:get{4} --- ... -hash.index['primary']:select{5} +hash.index['primary']:get{5} --- ... -- select by invalid keys -hash.index['primary']:select{'invalid key'} +hash.index['primary']:get{'invalid key'} --- - error: 'Supplied key type of part 0 does not match index part type: expected NUM' ... -hash.index['primary']:select{1, 2} +hash.index['primary']:get{1, 2} --- - error: Invalid key part count (expected [0..1], got 2) ... @@ -210,57 +210,57 @@ hash:replace{'invalid key', 'value1 v1.0', 'value2 v1.0'} -- 64-bit hash select fields test ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{0ULL} +hash.index['primary']:get{0ULL} --- - [0, 'value1 v1.0', 'value2 v1.0'] ... -hash.index['primary']:select{1ULL} +hash.index['primary']:get{1ULL} --- - [1, 'value1 v1.32', 'value2 1.72'] ... -hash.index['primary']:select{2ULL} +hash.index['primary']:get{2ULL} --- - [2, 'value1 v1.43', 'value2 1.92'] ... -hash.index['primary']:select{3ULL} +hash.index['primary']:get{3ULL} --- - [3, 'value1 v1.31', 'value2 1.12'] ... -hash.index['primary']:select{4ULL} +hash.index['primary']:get{4ULL} --- ... -hash.index['primary']:select{5ULL} +hash.index['primary']:get{5ULL} --- ... -- select by valid NUM keys -hash.index['primary']:select{0} +hash.index['primary']:get{0} --- - [0, 'value1 v1.0', 'value2 v1.0'] ... -hash.index['primary']:select{1} +hash.index['primary']:get{1} --- - [1, 'value1 v1.32', 'value2 1.72'] ... -hash.index['primary']:select{2} +hash.index['primary']:get{2} --- - [2, 'value1 v1.43', 'value2 1.92'] ... -hash.index['primary']:select{3} +hash.index['primary']:get{3} --- - [3, 'value1 v1.31', 'value2 1.12'] ... -hash.index['primary']:select{4} +hash.index['primary']:get{4} --- ... -hash.index['primary']:select{5} +hash.index['primary']:get{5} --- ... -- select by invalid keys -hash.index['primary']:select{'invalid key'} +hash.index['primary']:get{'invalid key'} --- - error: 'Supplied key type of part 0 does not match index part type: expected NUM' ... -hash.index['primary']:select{'00000001', '00000002'} +hash.index['primary']:get{'00000001', '00000002'} --- - error: Invalid key part count (expected [0..1], got 2) ... @@ -390,30 +390,30 @@ hash:replace{'key 2', 'value1 v1.43', 'value2 1.92'} -- String hash select fields test ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{'key 0'} +hash.index['primary']:get{'key 0'} --- - ['key 0', 'value1 v1.0', 'value2 v1.0'] ... -hash.index['primary']:select{'key 1'} +hash.index['primary']:get{'key 1'} --- - ['key 1', 'value1 v1.32', 'value2 1.72'] ... -hash.index['primary']:select{'key 2'} +hash.index['primary']:get{'key 2'} --- - ['key 2', 'value1 v1.43', 'value2 1.92'] ... -hash.index['primary']:select{'key 3'} +hash.index['primary']:get{'key 3'} --- - ['key 3', 'value1 v1.31', 'value2 1.12'] ... -hash.index['primary']:select{'key 4'} +hash.index['primary']:get{'key 4'} --- ... -hash.index['primary']:select{'key 5'} +hash.index['primary']:get{'key 5'} --- ... -- select by invalid keys -hash.index['primary']:select{'key 1', 'key 2'} +hash.index['primary']:get{'key 1', 'key 2'} --- - error: Invalid key part count (expected [0..1], got 2) ... @@ -486,31 +486,31 @@ hash:replace{1, 1, 1, 1} --- - [1, 1, 1, 1] ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- ... -hash.index['primary']:select{1} +hash.index['primary']:get{1} --- - [1, 1, 1, 1] ... -hash.index['field1']:select{1} +hash.index['field1']:get{1} --- - [1, 1, 1, 1] ... -hash.index['field2']:select{1} +hash.index['field2']:get{1} --- - [1, 1, 1, 1] ... -hash.index['field3']:select{1} +hash.index['field3']:get{1} --- - [1, 1, 1, 1] ... @@ -523,16 +523,16 @@ hash:delete{10} --- - [10, 10, 10, 10] ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- ... -- TupleFound (primary key) @@ -540,19 +540,19 @@ hash:insert{1, 10, 10, 10} --- - error: Duplicate key exists in unique index 0 ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- ... -hash.index['primary']:select{1} +hash.index['primary']:get{1} --- - [1, 1, 1, 1] ... @@ -561,19 +561,19 @@ hash:replace{10, 10, 10, 10} --- - [10, 10, 10, 10] ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- - [10, 10, 10, 10] ... @@ -582,45 +582,45 @@ hash:insert{10, 0, 10, 10} --- - error: Duplicate key exists in unique index 0 ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{0} +hash.index['field1']:get{0} --- - [0, 0, 0, 0] ... -- TupleFound (key --1) -- hash:replace_if_exists(2, 0, 10, 10) -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{0} +hash.index['field1']:get{0} --- - [0, 0, 0, 0] ... @@ -629,45 +629,45 @@ hash:insert{10, 10, 10, 0} --- - error: Duplicate key exists in unique index 0 ... -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{0} +hash.index['field3']:get{0} --- - [0, 0, 0, 0] ... -- TupleFound (key --3) -- hash:replace_if_exists(2, 10, 10, 0) -hash.index['primary']:select{10} +hash.index['primary']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field1']:select{10} +hash.index['field1']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field2']:select{10} +hash.index['field2']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{10} +hash.index['field3']:get{10} --- - [10, 10, 10, 10] ... -hash.index['field3']:select{0} +hash.index['field3']:get{0} --- - [0, 0, 0, 0] ... diff --git a/test/big/hash.test.lua b/test/big/hash.test.lua index 3764a71815a2db3e452e14ab67e8d9a1687869e9..bdef15f6e53cd23b0a965ce7f7f6fcbff3d3297d 100644 --- a/test/big/hash.test.lua +++ b/test/big/hash.test.lua @@ -35,16 +35,16 @@ hash:replace{'invalid key', 'value1 v1.0', 'value2 v1.0'} ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{0} -hash.index['primary']:select{1} -hash.index['primary']:select{2} -hash.index['primary']:select{3} -hash.index['primary']:select{4} -hash.index['primary']:select{5} +hash.index['primary']:get{0} +hash.index['primary']:get{1} +hash.index['primary']:get{2} +hash.index['primary']:get{3} +hash.index['primary']:get{4} +hash.index['primary']:get{5} -- select by invalid keys -hash.index['primary']:select{'invalid key'} -hash.index['primary']:select{1, 2} +hash.index['primary']:get{'invalid key'} +hash.index['primary']:get{1, 2} ------------------------------------------------------------------------------- -- 32-bit hash delete fields test @@ -104,24 +104,24 @@ hash:replace{'invalid key', 'value1 v1.0', 'value2 v1.0'} ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{0ULL} -hash.index['primary']:select{1ULL} -hash.index['primary']:select{2ULL} -hash.index['primary']:select{3ULL} -hash.index['primary']:select{4ULL} -hash.index['primary']:select{5ULL} +hash.index['primary']:get{0ULL} +hash.index['primary']:get{1ULL} +hash.index['primary']:get{2ULL} +hash.index['primary']:get{3ULL} +hash.index['primary']:get{4ULL} +hash.index['primary']:get{5ULL} -- select by valid NUM keys -hash.index['primary']:select{0} -hash.index['primary']:select{1} -hash.index['primary']:select{2} -hash.index['primary']:select{3} -hash.index['primary']:select{4} -hash.index['primary']:select{5} +hash.index['primary']:get{0} +hash.index['primary']:get{1} +hash.index['primary']:get{2} +hash.index['primary']:get{3} +hash.index['primary']:get{4} +hash.index['primary']:get{5} -- select by invalid keys -hash.index['primary']:select{'invalid key'} -hash.index['primary']:select{'00000001', '00000002'} +hash.index['primary']:get{'invalid key'} +hash.index['primary']:get{'00000001', '00000002'} ------------------------------------------------------------------------------- -- 64-bit hash delete fields test @@ -182,15 +182,15 @@ hash:replace{'key 2', 'value1 v1.43', 'value2 1.92'} ------------------------------------------------------------------------------- -- select by valid keys -hash.index['primary']:select{'key 0'} -hash.index['primary']:select{'key 1'} -hash.index['primary']:select{'key 2'} -hash.index['primary']:select{'key 3'} -hash.index['primary']:select{'key 4'} -hash.index['primary']:select{'key 5'} +hash.index['primary']:get{'key 0'} +hash.index['primary']:get{'key 1'} +hash.index['primary']:get{'key 2'} +hash.index['primary']:get{'key 3'} +hash.index['primary']:get{'key 4'} +hash.index['primary']:get{'key 5'} -- select by invalid keys -hash.index['primary']:select{'key 1', 'key 2'} +hash.index['primary']:get{'key 1', 'key 2'} ------------------------------------------------------------------------------- -- String hash delete fields test @@ -223,68 +223,68 @@ hash:insert{2, 2, 2, 2} -- OK hash:replace{1, 1, 1, 1} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['primary']:select{1} -hash.index['field1']:select{1} -hash.index['field2']:select{1} -hash.index['field3']:select{1} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['primary']:get{1} +hash.index['field1']:get{1} +hash.index['field2']:get{1} +hash.index['field3']:get{1} -- OK hash:insert{10, 10, 10, 10} hash:delete{10} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} -- TupleFound (primary key) hash:insert{1, 10, 10, 10} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['primary']:select{1} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['primary']:get{1} -- TupleNotFound (primary key) hash:replace{10, 10, 10, 10} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} -- TupleFound (key --1) hash:insert{10, 0, 10, 10} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['field1']:select{0} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['field1']:get{0} -- TupleFound (key --1) -- hash:replace_if_exists(2, 0, 10, 10) -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['field1']:select{0} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['field1']:get{0} -- TupleFound (key --3) hash:insert{10, 10, 10, 0} -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['field3']:select{0} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['field3']:get{0} -- TupleFound (key --3) -- hash:replace_if_exists(2, 10, 10, 0) -hash.index['primary']:select{10} -hash.index['field1']:select{10} -hash.index['field2']:select{10} -hash.index['field3']:select{10} -hash.index['field3']:select{0} +hash.index['primary']:get{10} +hash.index['field1']:get{10} +hash.index['field2']:get{10} +hash.index['field3']:get{10} +hash.index['field3']:get{0} hash:drop() diff --git a/test/big/hash_multipart.result b/test/big/hash_multipart.result index 4eedee33101b6ac93efb7f3916f7ace1302c3a3f..4eaad79a45b96e6a8a84dee15b237b0f5fd67080 100644 --- a/test/big/hash_multipart.result +++ b/test/big/hash_multipart.result @@ -72,40 +72,40 @@ box.sort(box.select_all()) - [1, 'foo', 1, '', 2] ... -- primary index select -hash.index['primary']:select{1, 'foo', 0} +hash.index['primary']:get{1, 'foo', 0} --- - [1, 'foo', 0, '', 2] ... -hash.index['primary']:select{1, 'bar', 0} +hash.index['primary']:get{1, 'bar', 0} --- - [1, 'bar', 0, '', 4] ... -- primary index select with missing part -hash.index['primary']:select{1, 'foo'} +hash.index['primary']:get{1, 'foo'} --- - error: Invalid key part count in an exact match (expected 3, got 2) ... -- primary index select with extra part -hash.index['primary']:select{1, 'foo', 0, 0} +hash.index['primary']:get{1, 'foo', 0, 0} --- - error: Invalid key part count (expected [0..3], got 4) ... -- primary index select with wrong type -hash.index['primary']:select{1, 'foo', 'baz'} +hash.index['primary']:get{1, 'foo', 'baz'} --- - error: 'Supplied key type of part 2 does not match index part type: expected NUM' ... -- secondary index select -hash.index['unique']:select{1, 4} +hash.index['unique']:get{1, 4} --- - [1, 'bar', 1, '', 4] ... -- secondary index select with no such key -hash.index['unique']:select{1, 5} +hash.index['unique']:get{1, 5} --- ... -- secondary index select with missing part -hash.index['unique']:select{1} +hash.index['unique']:get{1} --- - error: Invalid key part count in an exact match (expected 2, got 1) ... diff --git a/test/big/hash_multipart.test.lua b/test/big/hash_multipart.test.lua index 23b32bb600fe841c160941799d132efeb04e1958..4e1e0d0cb3c9a2b2a128403927f363b1dff27a55 100644 --- a/test/big/hash_multipart.test.lua +++ b/test/big/hash_multipart.test.lua @@ -31,21 +31,21 @@ end; box.sort(box.select_all()) -- primary index select -hash.index['primary']:select{1, 'foo', 0} -hash.index['primary']:select{1, 'bar', 0} +hash.index['primary']:get{1, 'foo', 0} +hash.index['primary']:get{1, 'bar', 0} -- primary index select with missing part -hash.index['primary']:select{1, 'foo'} +hash.index['primary']:get{1, 'foo'} -- primary index select with extra part -hash.index['primary']:select{1, 'foo', 0, 0} +hash.index['primary']:get{1, 'foo', 0, 0} -- primary index select with wrong type -hash.index['primary']:select{1, 'foo', 'baz'} +hash.index['primary']:get{1, 'foo', 'baz'} -- secondary index select -hash.index['unique']:select{1, 4} +hash.index['unique']:get{1, 4} -- secondary index select with no such key -hash.index['unique']:select{1, 5} +hash.index['unique']:get{1, 5} -- secondary index select with missing part -hash.index['unique']:select{1} +hash.index['unique']:get{1} -- secondary index select with wrong type hash.index['unique']:select{1, 'baz'} diff --git a/test/big/lua.result b/test/big/lua.result index 0f93ba12f824e4c5bde36147293ef205cf9e55c0..f2dbe9483bf9defffc38a4a1af16138aa06c225b 100644 --- a/test/big/lua.result +++ b/test/big/lua.result @@ -23,14 +23,14 @@ space.index['minmax']:max() --- - ['hello', 'old', 'world'] ... -space.index['minmax']:select{'new', 'world'} +space.index['minmax']:get{'new', 'world'} --- - ['brave', 'new', 'world'] ... -- A test case for Bug #904208 -- "assert failed, when key cardinality is greater than index cardinality" -- https://bugs.launchpad.net/tarantool/+bug/904208 -space.index['minmax']:select{'new', 'world', 'order'} +space.index['minmax']:get{'new', 'world', 'order'} --- - error: Invalid key part count (expected [0..2], got 3) ... @@ -45,7 +45,7 @@ space:insert{'item 1', 'alabama', 'song'} --- - ['item 1', 'alabama', 'song'] ... -space.index['minmax']:select{'alabama'} +space.index['minmax']:get{'alabama'} --- - ['item 1', 'alabama', 'song'] ... @@ -149,7 +149,7 @@ space:insert{2^51, 'hello', 'world'} --- - [2251799813685248, 'hello', 'world'] ... -space.index['primary']:select{2^51} +space.index['primary']:get{2^51} --- - [2251799813685248, 'hello', 'world'] ... @@ -169,7 +169,7 @@ space:insert{tonumber64('18446744073709551615'), 'magic'} --- - [18446744073709551615, 'magic'] ... -tuple = space.index['primary']:select{tonumber64('18446744073709551615')} +tuple = space.index['primary']:get{tonumber64('18446744073709551615')} --- ... num = tuple[0] @@ -202,10 +202,10 @@ space:insert{125ULL, 'magic'} --- - [125, 'magic'] ... -tuple = space.index['primary']:select{125} +tuple = space.index['primary']:get{125} --- ... -tuple2 = space.index['primary']:select{125LL} +tuple2 = space.index['primary']:get{125LL} --- ... num = tuple[0] @@ -868,9 +868,9 @@ space:insert{20, 30, 40, 50} ... space.index['primary']:select{} --- -- [1, 2, 3, 4] -- [10, 20, 30, 40] -- [20, 30, 40, 50] +- - [1, 2, 3, 4] + - [10, 20, 30, 40] + - [20, 30, 40, 50] ... -- Truncate must not hang space:truncate() @@ -879,6 +879,7 @@ space:truncate() -- Empty result space.index['primary']:select{} --- +- [] ... space:drop() --- diff --git a/test/big/lua.test.lua b/test/big/lua.test.lua index 541cf022b7e3b17783e38d01a65e1b9a6c2c78c7..3c77c280567a5fe250cca9e73a87c9571266b7f1 100644 --- a/test/big/lua.test.lua +++ b/test/big/lua.test.lua @@ -6,13 +6,13 @@ space:insert{'brave', 'new', 'world'} space:insert{'hello', 'old', 'world'} space.index['minmax']:min() space.index['minmax']:max() -space.index['minmax']:select{'new', 'world'} +space.index['minmax']:get{'new', 'world'} -- A test case for Bug #904208 -- "assert failed, when key cardinality is greater than index cardinality" -- https://bugs.launchpad.net/tarantool/+bug/904208 -space.index['minmax']:select{'new', 'world', 'order'} +space.index['minmax']:get{'new', 'world', 'order'} space:delete{'brave'} -- A test case for Bug #902091 @@ -20,7 +20,7 @@ space:delete{'brave'} -- https://bugs.launchpad.net/tarantool/+bug/902091 space:insert{'item 1', 'alabama', 'song'} -space.index['minmax']:select{'alabama'} +space.index['minmax']:get{'alabama'} space:insert{'item 2', 'california', 'dreaming '} space:insert{'item 3', 'california', 'uber alles'} space:insert{'item 4', 'georgia', 'on my mind'} @@ -59,7 +59,7 @@ space:truncate() -- space:insert{2^51, 'hello', 'world'} -space.index['primary']:select{2^51} +space.index['primary']:get{2^51} space:drop() -- @@ -69,7 +69,7 @@ space = box.schema.create_space('tweedledum') space:create_index('primary', { type = 'tree', parts = {0, 'num'}, unique = true }) space:insert{tonumber64('18446744073709551615'), 'magic'} -tuple = space.index['primary']:select{tonumber64('18446744073709551615')} +tuple = space.index['primary']:get{tonumber64('18446744073709551615')} num = tuple[0] num type(num) == 'cdata' @@ -78,8 +78,8 @@ num = tuple[0] num == tonumber64('18446744073709551615') space:delete{18446744073709551615ULL} space:insert{125ULL, 'magic'} -tuple = space.index['primary']:select{125} -tuple2 = space.index['primary']:select{125LL} +tuple = space.index['primary']:get{125} +tuple2 = space.index['primary']:get{125LL} num = tuple[0] num2 = tuple2[0] num, num2 diff --git a/test/big/lua/push.lua b/test/big/lua/push.lua index c7770d8c57693d04eaba790d4a430f7d2a36f71c..423946433eb56c6e8600193f91ff254f9298233f 100644 --- a/test/big/lua/push.lua +++ b/test/big/lua/push.lua @@ -1,7 +1,7 @@ function push_collection(space, size, cid, ...) local append = { ... } - local tuple = space:select{cid} + local tuple = space:get{cid} if tuple == nil then return space:insert{cid, unpack(append)} end diff --git a/test/big/sql.result b/test/big/sql.result index 8e358ad5d91cc7a78d5e6ec0ff70102f6d73d66d..4f8a570dfe36e3adbc8c81dbbb0ef642dd3bc976 100644 --- a/test/big/sql.result +++ b/test/big/sql.result @@ -128,9 +128,9 @@ insert into t0 values ('key3', 'part1', 'part2_b') ... s.index[1]:select{} --- -- ['key1', 'part1', 'part2'] -- ['key2', 'part1', 'part2_a'] -- ['key3', 'part1', 'part2_b'] +- - ['key1', 'part1', 'part2'] + - ['key2', 'part1', 'part2_a'] + - ['key3', 'part1', 'part2_b'] ... select * from t0 where k0='key1' --- @@ -265,10 +265,10 @@ select * from t0 where k1='part1_a' select * from t0 where k1='part_none' --- ... -box.space[0].index[1]:select{'part1', 'part2'} +box.space[0].index[1]:select({'part1', 'part2'}, { limit = 100 }) --- -- [1234567, 'part1', 'part2'] -- [11234567, 'part1', 'part2'] +- - [1234567, 'part1', 'part2'] + - [11234567, 'part1', 'part2'] ... select * from t0 where k1='part1' --- @@ -301,6 +301,7 @@ delete from t0 where k0=41234567 ... s:select{} --- +- [] ... s:truncate() --- @@ -551,9 +552,9 @@ insert into t0 values(3, 'Creature ') ... s.index[1]:select{} --- -- [1, 'Aardvark '] -- [2, 'Bilimbi'] -- [3, 'Creature '] +- - [1, 'Aardvark '] + - [2, 'Bilimbi'] + - [3, 'Creature '] ... s.index[0]:min() --- diff --git a/test/big/sql.test.py b/test/big/sql.test.py index b3d2f65da748cfd95eb1c23e395fa24900a59e24..be9de63fb435f1371c1a0fd10b6154e46c8a020a 100644 --- a/test/big/sql.test.py +++ b/test/big/sql.test.py @@ -98,7 +98,7 @@ sql("select * from t0 where k0=21234567") sql("select * from t0 where k1='part1'") sql("select * from t0 where k1='part1_a'") sql("select * from t0 where k1='part_none'") -admin("box.space[0].index[1]:select{'part1', 'part2'}") +admin("box.space[0].index[1]:select({'part1', 'part2'}, { limit = 100 })") sql("select * from t0 where k1='part1'") sql("select * from t0 where k1='part2'") # cleanup diff --git a/test/big/tree_pk.result b/test/big/tree_pk.result index 65296a7b60db9e39809a17f8284893262a924ca0..0fd10e8f7e975cf015230fda8245ceca613488fe 100644 --- a/test/big/tree_pk.result +++ b/test/big/tree_pk.result @@ -28,15 +28,15 @@ s0:insert{3, 'tuple 3'} --- - [3, 'tuple 3'] ... -s0.index['primary']:select{1} +s0.index['primary']:get{1} --- - [1, 'tuple'] ... -s0.index['primary']:select{2} +s0.index['primary']:get{2} --- - [2, 'tuple 2'] ... -s0.index['primary']:select{3} +s0.index['primary']:get{3} --- - [3, 'tuple 3'] ... @@ -109,15 +109,15 @@ s1:insert{'third', 'tuple 3'} --- - ['third', 'tuple 3'] ... -s1.index['primary']:select{'identifier'} +s1.index['primary']:get{'identifier'} --- - ['identifier', 'tuple'] ... -s1.index['primary']:select{'second'} +s1.index['primary']:get{'second'} --- - ['second', 'tuple 2'] ... -s1.index['primary']:select{'third'} +s1.index['primary']:get{'third'} --- - ['third', 'tuple 3'] ... @@ -201,14 +201,14 @@ s0:insert{200, 'select me!'} --- - [200, 'select me!'] ... -s0.index['primary']:select{200} +s0.index['primary']:get{200} --- - [200, 'select me!'] ... -s0.index['primary']:select{199} +s0.index['primary']:get{199} --- ... -s0.index['primary']:select{201} +s0.index['primary']:get{201} --- ... -- Test partially specified keys in TREE indexes @@ -306,33 +306,36 @@ s0:replace{1, 1, 1, 1} --- - [1, 1, 1, 1] ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- ... s0.index['i1']:select{10} --- +- [] ... s0.index['i2']:select{10} --- +- [] ... s0.index['i3']:select{10} --- +- [] ... -s0.index['primary']:select{1} +s0.index['primary']:get{1} --- - [1, 1, 1, 1] ... s0.index['i1']:select{1} --- -- [1, 1, 1, 1] +- - [1, 1, 1, 1] ... s0.index['i2']:select{1} --- -- [1, 1, 1, 1] +- - [1, 1, 1, 1] ... s0.index['i3']:select{1} --- -- [1, 1, 1, 1] +- - [1, 1, 1, 1] ... -- OK s0:insert{10, 10, 10, 10} @@ -343,36 +346,42 @@ s0:delete{10} --- - [10, 10, 10, 10] ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- ... s0.index['i1']:select{10} --- +- [] ... s0.index['i2']:select{10} --- +- [] ... s0.index['i3']:select{10} --- +- [] ... -- TupleFound (primary key) s0:insert{1, 10, 10, 10} --- - error: Duplicate key exists in unique index 0 ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- ... s0.index['i1']:select{10} --- +- [] ... s0.index['i2']:select{10} --- +- [] ... s0.index['i3']:select{10} --- +- [] ... -s0.index['primary']:select{1} +s0.index['primary']:get{1} --- - [1, 1, 1, 1] ... @@ -381,121 +390,121 @@ s0:replace{10, 10, 10, 10} --- - [10, 10, 10, 10] ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- - [10, 10, 10, 10] ... s0.index['i1']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i2']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... -- TupleFound (key #1) s0:insert{10, 0, 10, 10} --- - error: Duplicate key exists in unique index 0 ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- - [10, 10, 10, 10] ... s0.index['i1']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i2']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i1']:select{0} --- -- [0, 0, 0, 0] +- - [0, 0, 0, 0] ... -- TupleFound (key #1) s0:replace{2, 0, 10, 10} --- - error: Duplicate key exists in unique index 1 ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- - [10, 10, 10, 10] ... s0.index['i1']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i2']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i1']:select{0} --- -- [0, 0, 0, 0] +- - [0, 0, 0, 0] ... -- TupleFound (key #3) s0:insert{10, 10, 10, 0} --- - error: Duplicate key exists in unique index 0 ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- - [10, 10, 10, 10] ... s0.index['i1']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i2']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{0} --- -- [0, 0, 0, 0] +- - [0, 0, 0, 0] ... -- TupleFound (key #3) s0:replace{2, 10, 10, 0} --- - error: Duplicate key exists in unique index 1 ... -s0.index['primary']:select{10} +s0.index['primary']:get{10} --- - [10, 10, 10, 10] ... s0.index['i1']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i2']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{10} --- -- [10, 10, 10, 10] +- - [10, 10, 10, 10] ... s0.index['i3']:select{0} --- -- [0, 0, 0, 0] +- - [0, 0, 0, 0] ... -- Non-Uniq test (key #2) s0:insert{4, 4, 0, 4} @@ -514,7 +523,7 @@ s0:replace{5, 5, 0, 5} --- - [5, 5, 0, 5] ... -box.sort({s0.index['i2']:select{0}}) +box.sort(s0.index['i2']:select(0, { limit = 100 })) --- - - [0, 0, 0, 0] - [4, 4, 0, 4] @@ -525,7 +534,7 @@ s0:delete{5} --- - [5, 5, 0, 5] ... -box.sort({s0.index['i2']:select{0}}) +box.sort(s0.index['i2']:select(0, { limit = 100 })) --- - - [0, 0, 0, 0] - [4, 4, 0, 4] diff --git a/test/big/tree_pk.test.lua b/test/big/tree_pk.test.lua index 9c600a6ef645c9b97b61c665b027b644f46dc937..02ae7f4d1265a6b5c91105d933d043bf56bdb94c 100644 --- a/test/big/tree_pk.test.lua +++ b/test/big/tree_pk.test.lua @@ -10,9 +10,9 @@ s0:insert{2, 'tuple 2'} box.snapshot() s0:insert{3, 'tuple 3'} -s0.index['primary']:select{1} -s0.index['primary']:select{2} -s0.index['primary']:select{3} +s0.index['primary']:get{1} +s0.index['primary']:get{2} +s0.index['primary']:get{3} -- Cleanup s0:delete{1} @@ -40,9 +40,9 @@ s1.index['primary']:eselect('second', { limit = 100, iterator = 'GE' }) s1.index['primary']:eselect('identifier', { limit = 100, iterator = 'GE' }) s1:insert{'third', 'tuple 3'} -s1.index['primary']:select{'identifier'} -s1.index['primary']:select{'second'} -s1.index['primary']:select{'third'} +s1.index['primary']:get{'identifier'} +s1.index['primary']:get{'second'} +s1.index['primary']:get{'third'} -- Cleanup s1:delete{'identifier'} @@ -82,9 +82,9 @@ s2:truncate() -- Bug #922520 - select missing keys s0:insert{200, 'select me!'} -s0.index['primary']:select{200} -s0.index['primary']:select{199} -s0.index['primary']:select{201} +s0.index['primary']:get{200} +s0.index['primary']:get{199} +s0.index['primary']:get{201} -- Test partially specified keys in TREE indexes s1:insert{'abcd'} @@ -119,11 +119,11 @@ s0:insert{2, 2, 2, 2} s0:replace{1, 1, 1, 1} s0:replace{1, 10, 10, 10} s0:replace{1, 1, 1, 1} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} -s0.index['primary']:select{1} +s0.index['primary']:get{1} s0.index['i1']:select{1} s0.index['i2']:select{1} s0.index['i3']:select{1} @@ -131,7 +131,7 @@ s0.index['i3']:select{1} -- OK s0:insert{10, 10, 10, 10} s0:delete{10} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} @@ -139,22 +139,22 @@ s0.index['i3']:select{10} -- TupleFound (primary key) s0:insert{1, 10, 10, 10} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} -s0.index['primary']:select{1} +s0.index['primary']:get{1} -- TupleNotFound (primary key) s0:replace{10, 10, 10, 10} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} -- TupleFound (key #1) s0:insert{10, 0, 10, 10} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} @@ -162,7 +162,7 @@ s0.index['i1']:select{0} -- TupleFound (key #1) s0:replace{2, 0, 10, 10} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} @@ -170,7 +170,7 @@ s0.index['i1']:select{0} -- TupleFound (key #3) s0:insert{10, 10, 10, 0} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} @@ -178,7 +178,7 @@ s0.index['i3']:select{0} -- TupleFound (key #3) s0:replace{2, 10, 10, 0} -s0.index['primary']:select{10} +s0.index['primary']:get{10} s0.index['i1']:select{10} s0.index['i2']:select{10} s0.index['i3']:select{10} @@ -189,9 +189,9 @@ s0:insert{4, 4, 0, 4} s0:insert{5, 5, 0, 5} s0:insert{6, 6, 0, 6} s0:replace{5, 5, 0, 5} -box.sort({s0.index['i2']:select{0}}) +box.sort(s0.index['i2']:select(0, { limit = 100 })) s0:delete{5} -box.sort({s0.index['i2']:select{0}}) +box.sort(s0.index['i2']:select(0, { limit = 100 })) s0:drop() s0 = nil diff --git a/test/big/tree_pk_multipart.result b/test/big/tree_pk_multipart.result index edc9eb44c4b0fae80a123b4dfd61bb26800e98f8..febbab6bba8e6220f82a41d8c8958fbbbc80123e 100644 --- a/test/big/tree_pk_multipart.result +++ b/test/big/tree_pk_multipart.result @@ -100,155 +100,155 @@ space:insert{'Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time -- Select test -- -- Select by one entry -space.index['primary']:select{'Vincent', 'Jules', 0} +space.index['primary']:get{'Vincent', 'Jules', 0} --- - ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with cheese in Paris?'] ... -space.index['primary']:select{'Jules', 'Vincent', 0} +space.index['primary']:get{'Jules', 'Vincent', 0} --- - ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?'] ... -space.index['primary']:select{'Vincent', 'Jules', 1} +space.index['primary']:get{'Vincent', 'Jules', 1} --- - ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know what the f--k a Quarter Pounder is.'] ... -space.index['primary']:select{'Jules', 'Vincent', 1} +space.index['primary']:get{'Jules', 'Vincent', 1} --- - ['Jules', 'Vincent', 1, 'Then what do they call it?'] ... -space.index['primary']:select{'Vincent', 'Jules', 2} +space.index['primary']:get{'Vincent', 'Jules', 2} --- - ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'] ... -space.index['primary']:select{'Jules', 'Vincent', 2} +space.index['primary']:get{'Jules', 'Vincent', 2} --- - ['Jules', 'Vincent', 2, 'A `Royale` with cheese!'] ... -space.index['primary']:select{'Vincent', 'Jules', 3} +space.index['primary']:get{'Vincent', 'Jules', 3} --- - ['Vincent', 'Jules', 3, 'That`s right.'] ... -space.index['primary']:select{'Jules', 'Vincent', 3} +space.index['primary']:get{'Jules', 'Vincent', 3} --- - ['Jules', 'Vincent', 3, 'What do they call a Big Mac?'] ... -space.index['primary']:select{'Vincent', 'Jules', 4} +space.index['primary']:get{'Vincent', 'Jules', 4} --- - ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'] ... -space.index['primary']:select{'Jules', 'Vincent', 4} +space.index['primary']:get{'Jules', 'Vincent', 4} --- - ['Jules', 'Vincent', 4, '`Le Big Mac!`'] ... -space.index['primary']:select{'Vincent', 'Jules', 5} +space.index['primary']:get{'Vincent', 'Jules', 5} --- - ['Vincent', 'Jules', 5, 'Ha, ha, ha.'] ... -space.index['primary']:select{'Jules', 'Vincent', 5} +space.index['primary']:get{'Jules', 'Vincent', 5} --- - ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?'] ... -space.index['primary']:select{'Vincent', 'Jules', 6} +space.index['primary']:get{'Vincent', 'Jules', 6} --- - ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'] ... -space.index['primary']:select{'The Wolf!', 'Vincent', 0} +space.index['primary']:get{'The Wolf!', 'Vincent', 0} --- - ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.'] ... -space.index['primary']:select{'Vincent', 'The Wolf!', 0} +space.index['primary']:get{'Vincent', 'The Wolf!', 0} --- - ['Vincent', 'The Wolf!', 0, 'A please would be nice.'] ... -space.index['primary']:select{'The Wolf!', 'Vincent', 1} +space.index['primary']:get{'The Wolf!', 'Vincent', 1} --- - ['The Wolf!', 'Vincent', 1, 'Come again?'] ... -space.index['primary']:select{'Vincent', 'The Wolf!', 1} +space.index['primary']:get{'Vincent', 'The Wolf!', 1} --- - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] ... -space.index['primary']:select{'The Wolf!', 'Vincent', 2} +space.index['primary']:get{'The Wolf!', 'Vincent', 2} --- - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, I`m here to tell you what to do and if self-preservation is an instinct you possess you`d better fucking do it and do it quick. I`m here to help - if my help`s not appreciated then lotsa luck, gentlemen.'] ... -space.index['primary']:select{'The Wolf!', 'Vincent', 3} +space.index['primary']:get{'The Wolf!', 'Vincent', 3} --- - ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people barking orders at me.'] ... -space.index['primary']:select{'Vincent', 'The Wolf!', 2} +space.index['primary']:get{'Vincent', 'The Wolf!', 2} --- - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. I think fast, I talk fast and I need you guys to act fast if you wanna get out of this. So, pretty please... with sugar on top. Clean the fucking car.'] ... -- Select all messages from Vincent to Jules -space.index['primary']:select{'Vincent', 'Jules'} ---- -- ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with - cheese in Paris?'] -- ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know - what the f--k a Quarter Pounder is.'] -- ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'] -- ['Vincent', 'Jules', 3, 'That`s right.'] -- ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'] -- ['Vincent', 'Jules', 5, 'Ha, ha, ha.'] -- ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'] +space.index['primary']:select({'Vincent', 'Jules'}, { limit = 100 }) +--- +- - ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder + with cheese in Paris?'] + - ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know + what the f--k a Quarter Pounder is.'] + - ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'] + - ['Vincent', 'Jules', 3, 'That`s right.'] + - ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'] + - ['Vincent', 'Jules', 5, 'Ha, ha, ha.'] + - ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'] ... -- Select all messages from Jules to Vincent -space.index['primary']:select{'Jules', 'Vincent'} +space.index['primary']:select({'Jules', 'Vincent'}, { limit = 100 }) --- -- ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?'] -- ['Jules', 'Vincent', 1, 'Then what do they call it?'] -- ['Jules', 'Vincent', 2, 'A `Royale` with cheese!'] -- ['Jules', 'Vincent', 3, 'What do they call a Big Mac?'] -- ['Jules', 'Vincent', 4, '`Le Big Mac!`'] -- ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?'] +- - ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?'] + - ['Jules', 'Vincent', 1, 'Then what do they call it?'] + - ['Jules', 'Vincent', 2, 'A `Royale` with cheese!'] + - ['Jules', 'Vincent', 3, 'What do they call a Big Mac?'] + - ['Jules', 'Vincent', 4, '`Le Big Mac!`'] + - ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?'] ... -- Select all messages from Vincent to The Wolf -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) --- -- ['Vincent', 'The Wolf!', 0, 'A please would be nice.'] -- ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] -- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. - I think fast, I talk fast and I need you guys to act fast if you wanna get out - of this. So, pretty please... with sugar on top. Clean the fucking car.'] +- - ['Vincent', 'The Wolf!', 0, 'A please would be nice.'] + - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] + - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. + I think fast, I talk fast and I need you guys to act fast if you wanna get out + of this. So, pretty please... with sugar on top. Clean the fucking car.'] ... -- Select all messages from The Wolf to Vincent -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) --- -- ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.'] -- ['The Wolf!', 'Vincent', 1, 'Come again?'] -- ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, - I`m here to tell you what to do and if self-preservation is an instinct you possess - you`d better fucking do it and do it quick. I`m here to help - if my help`s not - appreciated then lotsa luck, gentlemen.'] -- ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people - barking orders at me.'] +- - ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.'] + - ['The Wolf!', 'Vincent', 1, 'Come again?'] + - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, + I`m here to tell you what to do and if self-preservation is an instinct you + possess you`d better fucking do it and do it quick. I`m here to help - if my + help`s not appreciated then lotsa luck, gentlemen.'] + - ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people + barking orders at me.'] ... -- Select all Vincent messages -space.index['primary']:select{'Vincent'} ---- -- ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with - cheese in Paris?'] -- ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know - what the f--k a Quarter Pounder is.'] -- ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'] -- ['Vincent', 'Jules', 3, 'That`s right.'] -- ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'] -- ['Vincent', 'Jules', 5, 'Ha, ha, ha.'] -- ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'] -- ['Vincent', 'The Wolf!', 0, 'A please would be nice.'] -- ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] -- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. - I think fast, I talk fast and I need you guys to act fast if you wanna get out - of this. So, pretty please... with sugar on top. Clean the fucking car.'] +space.index['primary']:select({'Vincent'}, { limit = 100 }) +--- +- - ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder + with cheese in Paris?'] + - ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know + what the f--k a Quarter Pounder is.'] + - ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'] + - ['Vincent', 'Jules', 3, 'That`s right.'] + - ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'] + - ['Vincent', 'Jules', 5, 'Ha, ha, ha.'] + - ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'] + - ['Vincent', 'The Wolf!', 0, 'A please would be nice.'] + - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] + - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. + I think fast, I talk fast and I need you guys to act fast if you wanna get out + of this. So, pretty please... with sugar on top. Clean the fucking car.'] ... -- -- Delete test @@ -276,21 +276,21 @@ space:update({'Updated', 'The Wolf!', 1}, {{ '=', 0, 'Vincent'}, { '#', 4, 1 }}) - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] ... -- Checking Vincent's last messages -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) --- -- ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] -- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. - I think fast, I talk fast and I need you guys to act fast if you wanna get out - of this. So, pretty please... with sugar on top. Clean the fucking car.'] +- - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.'] + - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. + I think fast, I talk fast and I need you guys to act fast if you wanna get out + of this. So, pretty please... with sugar on top. Clean the fucking car.'] ... -- Checking The Wolf's last messages -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) --- -- ['The Wolf!', 'Vincent', 1, 'Come again?'] -- ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, - I`m here to tell you what to do and if self-preservation is an instinct you possess - you`d better fucking do it and do it quick. I`m here to help - if my help`s not - appreciated then lotsa luck, gentlemen.'] +- - ['The Wolf!', 'Vincent', 1, 'Come again?'] + - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, + I`m here to tell you what to do and if self-preservation is an instinct you + possess you`d better fucking do it and do it quick. I`m here to help - if my + help`s not appreciated then lotsa luck, gentlemen.'] ... -- try to delete nonexistent message space:delete{'Vincent', 'The Wolf!', 3} @@ -318,21 +318,21 @@ space:update({'Vincent', 'The Wolf!', 1}, {{'=', 3, '<ooops>'}}) - ['Vincent', 'The Wolf!', 1, '<ooops>'] ... -- Checking Vincent's last messages -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) --- -- ['Vincent', 'The Wolf!', 1, '<ooops>'] -- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. - I think fast, I talk fast and I need you guys to act fast if you wanna get out - of this. So, pretty please... with sugar on top. Clean the fucking car.'] +- - ['Vincent', 'The Wolf!', 1, '<ooops>'] + - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. + I think fast, I talk fast and I need you guys to act fast if you wanna get out + of this. So, pretty please... with sugar on top. Clean the fucking car.'] ... -- Checking The Wolf's last messages -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) --- -- ['The Wolf!', 'Vincent', 1, '<ooops>'] -- ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, - I`m here to tell you what to do and if self-preservation is an instinct you possess - you`d better fucking do it and do it quick. I`m here to help - if my help`s not - appreciated then lotsa luck, gentlemen.'] +- - ['The Wolf!', 'Vincent', 1, '<ooops>'] + - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, + I`m here to tell you what to do and if self-preservation is an instinct you + possess you`d better fucking do it and do it quick. I`m here to help - if my + help`s not appreciated then lotsa luck, gentlemen.'] ... -- try to update a nonexistent message space:update({'Vincent', 'The Wolf!', 3}, {{'=', 3, '<ooops>'}}) diff --git a/test/big/tree_pk_multipart.test.lua b/test/big/tree_pk_multipart.test.lua index ce1f270f1287324f23f8980b6781b6c68c523f0c..a049313356771c30bbced7c4d1d928312a47a66f 100644 --- a/test/big/tree_pk_multipart.test.lua +++ b/test/big/tree_pk_multipart.test.lua @@ -32,42 +32,42 @@ space:insert{'Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time -- -- Select by one entry -space.index['primary']:select{'Vincent', 'Jules', 0} -space.index['primary']:select{'Jules', 'Vincent', 0} -space.index['primary']:select{'Vincent', 'Jules', 1} -space.index['primary']:select{'Jules', 'Vincent', 1} -space.index['primary']:select{'Vincent', 'Jules', 2} -space.index['primary']:select{'Jules', 'Vincent', 2} -space.index['primary']:select{'Vincent', 'Jules', 3} -space.index['primary']:select{'Jules', 'Vincent', 3} -space.index['primary']:select{'Vincent', 'Jules', 4} -space.index['primary']:select{'Jules', 'Vincent', 4} -space.index['primary']:select{'Vincent', 'Jules', 5} -space.index['primary']:select{'Jules', 'Vincent', 5} -space.index['primary']:select{'Vincent', 'Jules', 6} - -space.index['primary']:select{'The Wolf!', 'Vincent', 0} -space.index['primary']:select{'Vincent', 'The Wolf!', 0} -space.index['primary']:select{'The Wolf!', 'Vincent', 1} -space.index['primary']:select{'Vincent', 'The Wolf!', 1} -space.index['primary']:select{'The Wolf!', 'Vincent', 2} -space.index['primary']:select{'The Wolf!', 'Vincent', 3} -space.index['primary']:select{'Vincent', 'The Wolf!', 2} +space.index['primary']:get{'Vincent', 'Jules', 0} +space.index['primary']:get{'Jules', 'Vincent', 0} +space.index['primary']:get{'Vincent', 'Jules', 1} +space.index['primary']:get{'Jules', 'Vincent', 1} +space.index['primary']:get{'Vincent', 'Jules', 2} +space.index['primary']:get{'Jules', 'Vincent', 2} +space.index['primary']:get{'Vincent', 'Jules', 3} +space.index['primary']:get{'Jules', 'Vincent', 3} +space.index['primary']:get{'Vincent', 'Jules', 4} +space.index['primary']:get{'Jules', 'Vincent', 4} +space.index['primary']:get{'Vincent', 'Jules', 5} +space.index['primary']:get{'Jules', 'Vincent', 5} +space.index['primary']:get{'Vincent', 'Jules', 6} + +space.index['primary']:get{'The Wolf!', 'Vincent', 0} +space.index['primary']:get{'Vincent', 'The Wolf!', 0} +space.index['primary']:get{'The Wolf!', 'Vincent', 1} +space.index['primary']:get{'Vincent', 'The Wolf!', 1} +space.index['primary']:get{'The Wolf!', 'Vincent', 2} +space.index['primary']:get{'The Wolf!', 'Vincent', 3} +space.index['primary']:get{'Vincent', 'The Wolf!', 2} -- Select all messages from Vincent to Jules -space.index['primary']:select{'Vincent', 'Jules'} +space.index['primary']:select({'Vincent', 'Jules'}, { limit = 100 }) -- Select all messages from Jules to Vincent -space.index['primary']:select{'Jules', 'Vincent'} +space.index['primary']:select({'Jules', 'Vincent'}, { limit = 100 }) -- Select all messages from Vincent to The Wolf -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) -- Select all messages from The Wolf to Vincent -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) -- Select all Vincent messages -space.index['primary']:select{'Vincent'} +space.index['primary']:select({'Vincent'}, { limit = 100 }) -- -- Delete test @@ -81,9 +81,9 @@ space:delete{'Vincent', 'The Wolf!', 0} space:update({'Vincent', 'The Wolf!', 1}, {{ '=', 0, 'Updated' }, {'=', 4, 'New'}}) space:update({'Updated', 'The Wolf!', 1}, {{ '=', 0, 'Vincent'}, { '#', 4, 1 }}) -- Checking Vincent's last messages -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) -- Checking The Wolf's last messages -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) -- try to delete nonexistent message space:delete{'Vincent', 'The Wolf!', 3} @@ -99,9 +99,9 @@ space:update({'The Wolf!', 'Vincent', 1}, {{'=', 3, '<ooops>'}}) space:update({'Vincent', 'The Wolf!', 1}, {{'=', 3, '<ooops>'}}) -- Checking Vincent's last messages -space.index['primary']:select{'Vincent', 'The Wolf!'} +space.index['primary']:select({'Vincent', 'The Wolf!'}, { limit = 100 }) -- Checking The Wolf's last messages -space.index['primary']:select{'The Wolf!', 'Vincent'} +space.index['primary']:select({'The Wolf!', 'Vincent'}, { limit = 100 }) -- try to update a nonexistent message space:update({'Vincent', 'The Wolf!', 3}, {{'=', 3, '<ooops>'}}) diff --git a/test/big/tree_variants.result b/test/big/tree_variants.result index 4f638d6f3f585eeb01280060c6b6925368beb977..2df5f482ff4b7a211bef0522351ce9def1c29754 100644 --- a/test/big/tree_variants.result +++ b/test/big/tree_variants.result @@ -62,43 +62,43 @@ space:insert{9, 9, 400, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009} --- - [9, 9, 400, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009] ... -space.index['primary']:select{1} +space.index['primary']:get{1} --- - [1, 1, 200, 'Joe', 'Sixpack', 'Drinks', 'Heineken', 'bar', 2001] ... space.index['i1']:select{2} --- -- [2, 2, 200, 'Joe', 'Sixpack', 'Drinks', 'Carlsberg', 'bar', 2002] +- - [2, 2, 200, 'Joe', 'Sixpack', 'Drinks', 'Carlsberg', 'bar', 2002] ... -{space.index[2]:select{300}} +space.index[2]:select({300}, { limit = 100 }) --- - - [3, 3, 300, 'Joe', 'Sixpack', 'Drinks', 'Corona Extra', 'bar', 2003] - [4, 4, 300, 'Joe', 'Sixpack', 'Drinks', 'Stella Artois', 'bar', 2004] - [5, 5, 300, 'Joe', 'Sixpack', 'Drinks', 'Miller Genuine Draft', 'bar', 2005] ... -#{space.index['i3']:select{'Joe', 'Sixpack'}} +#space.index['i3']:select({'Joe', 'Sixpack'}, { limit = 100 }) --- - 6 ... -#{space.index['i3']:select{'John'}} +#space.index['i3']:select('John', { limit = 100 }) --- - 4 ... -#{space.index['i4']:select{'A Pipe'}} +#space.index['i4']:select('A Pipe', { limit = 100 }) --- - 1 ... {space.index['i4']:select{'Miller Genuine Draft', 'Drinks'}} --- -- - [5, 5, 300, 'Joe', 'Sixpack', 'Drinks', 'Miller Genuine Draft', 'bar', 2005] +- - - [5, 5, 300, 'Joe', 'Sixpack', 'Drinks', 'Miller Genuine Draft', 'bar', 2005] ... space.index['i5']:select{2007} --- -- [7, 7, 400, 'John', 'Smoker', 'Hits', 'A Bong', 'foo', 2007] +- - [7, 7, 400, 'John', 'Smoker', 'Hits', 'A Bong', 'foo', 2007] ... space.index[6]:select{'Miller Genuine Draft', 'Drinks'} --- -- [5, 5, 300, 'Joe', 'Sixpack', 'Drinks', 'Miller Genuine Draft', 'bar', 2005] +- - [5, 5, 300, 'Joe', 'Sixpack', 'Drinks', 'Miller Genuine Draft', 'bar', 2005] ... space:delete{6} --- @@ -134,27 +134,27 @@ space:insert{9, 9ULL, 400ULL, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009} ... space.index['i1']:select{6ULL} --- -- [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] +- - [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] ... space.index['i1']:select{6} --- -- [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] +- - [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] ... -{space.index['i2']:select{400ULL}} +space.index['i2']:select(400ULL, { limit = 100 }) --- - - [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] - [7, 7, 400, 'John', 'Smoker', 'Hits', 'A Bong', 'foo', 2007] - [8, 8, 400, 'John', 'Smoker', 'Rolls', 'A Joint', 'foo', 2008] - [9, 9, 400, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009] ... -{space.index['i2']:select{400}} +space.index['i2']:select(400, { limit = 100}) --- - - [6, 6, 400, 'John', 'Smoker', 'Hits', 'A Pipe', 'foo', 2006] - [7, 7, 400, 'John', 'Smoker', 'Hits', 'A Bong', 'foo', 2007] - [8, 8, 400, 'John', 'Smoker', 'Rolls', 'A Joint', 'foo', 2008] - [9, 9, 400, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009] ... -{space:select{}} +space:select{} --- - - [0, 0, 100, 'Joe', 'Sixpack', 'Drinks', 'Amstel', 'bar', 2000] - [1, 1, 200, 'Joe', 'Sixpack', 'Drinks', 'Heineken', 'bar', 2001] diff --git a/test/big/tree_variants.test.lua b/test/big/tree_variants.test.lua index 89e4ce730f107376e38691ab3367d42d341ed6e4..a7d4899982539fc2b64c35d7850bc82514226b65 100644 --- a/test/big/tree_variants.test.lua +++ b/test/big/tree_variants.test.lua @@ -18,12 +18,12 @@ space:insert{7, 7, 400, 'John', 'Smoker', 'Hits', 'A Bong', 'foo', 2007} space:insert{8, 8, 400, 'John', 'Smoker', 'Rolls', 'A Joint', 'foo', 2008} space:insert{9, 9, 400, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009} -space.index['primary']:select{1} +space.index['primary']:get{1} space.index['i1']:select{2} -{space.index[2]:select{300}} -#{space.index['i3']:select{'Joe', 'Sixpack'}} -#{space.index['i3']:select{'John'}} -#{space.index['i4']:select{'A Pipe'}} +space.index[2]:select({300}, { limit = 100 }) +#space.index['i3']:select({'Joe', 'Sixpack'}, { limit = 100 }) +#space.index['i3']:select('John', { limit = 100 }) +#space.index['i4']:select('A Pipe', { limit = 100 }) {space.index['i4']:select{'Miller Genuine Draft', 'Drinks'}} space.index['i5']:select{2007} space.index[6]:select{'Miller Genuine Draft', 'Drinks'} @@ -40,10 +40,10 @@ space:insert{9, 9ULL, 400ULL, 'John', 'Smoker', 'Rolls', 'A Blunt', 'foo', 2009} space.index['i1']:select{6ULL} space.index['i1']:select{6} -{space.index['i2']:select{400ULL}} -{space.index['i2']:select{400}} +space.index['i2']:select(400ULL, { limit = 100 }) +space.index['i2']:select(400, { limit = 100}) -{space:select{}} +space:select{} -- Test incorrect keys - supplied key field type does not match index type -- https://bugs.launchpad.net/tarantool/+bug/1072624 diff --git a/test/box/alter.result b/test/box/alter.result index 4d702f4f4fabe41bcb54afabb1e62a4a6178fd34..71fe92ccda806b3b60f8fbd19f57106a15ddfd72 100644 --- a/test/box/alter.result +++ b/test/box/alter.result @@ -151,11 +151,11 @@ _index:replace{_index.n, 0, 'primary', 'tree', 1, 2, 0, 'num', 1, 'num'} ... _index:select{} --- -- [272, 0, 'primary', 'tree', 1, 1, 0, 'str'] -- [280, 0, 'primary', 'tree', 1, 1, 0, 'num'] -- [280, 1, 'name', 'tree', 1, 1, 2, 'str'] -- [288, 0, 'primary', 'tree', 1, 2, 0, 'num', 1, 'num'] -- [288, 1, 'name', 'tree', 1, 2, 0, 'num', 2, 'str'] +- - [272, 0, 'primary', 'tree', 1, 1, 0, 'str'] + - [280, 0, 'primary', 'tree', 1, 1, 0, 'num'] + - [280, 1, 'name', 'tree', 1, 1, 2, 'str'] + - [288, 0, 'primary', 'tree', 1, 2, 0, 'num', 1, 'num'] + - [288, 1, 'name', 'tree', 1, 2, 0, 'num', 2, 'str'] ... -- modify indexes of a system space _index:delete{_index.n, 0} diff --git a/test/box/alter_limits.result b/test/box/alter_limits.result index 85f5d1d0aa7fbce22aff8acb87a1af2d6b1cc095..03b43e0f3e9ed651c490c420cccc7a52c0204963 100644 --- a/test/box/alter_limits.result +++ b/test/box/alter_limits.result @@ -242,7 +242,7 @@ s:insert{1, 2, 3} ... s:select{} --- -- [1, 2] +- - [1, 2] ... -- increase arity -- error box.space['_space']:update(s.n, {{"=", 1, 3}}) @@ -251,7 +251,7 @@ box.space['_space']:update(s.n, {{"=", 1, 3}}) ... s:select{} --- -- [1, 2] +- - [1, 2] ... -- decrease arity - error box.space['_space']:update(s.n, {{"=", 1, 1}}) @@ -265,7 +265,7 @@ box.space['_space']:update(s.n, {{"=", 1, 0}}) ... s:select{} --- -- [1, 2] +- - [1, 2] ... -- increase arity - error box.space['_space']:update(s.n, {{"=", 1, 3}}) @@ -277,6 +277,7 @@ s:truncate() ... s:select{} --- +- [] ... -- set arity of an empty space box.space['_space']:update(s.n, {{"=", 1, 3}}) @@ -285,6 +286,7 @@ box.space['_space']:update(s.n, {{"=", 1, 3}}) ... s:select{} --- +- [] ... -- arity actually works s:insert{3, 4} @@ -305,8 +307,8 @@ s:insert{7, 8, 9} ... s:select{} --- -- [3, 4, 5] -- [7, 8, 9] +- - [3, 4, 5] + - [7, 8, 9] ... -- check transition of space from enabled to disabled on -- deletion of the primary key @@ -727,13 +729,13 @@ s:create_index('year', { type = 'tree', unique=false, parts = { 1, 'num'} }) ... s.index.primary:select{} --- -- ['Almanya - Willkommen in Deutschland', 2011] -- ['Barbara', 2012] -- ['Cloud Atlas', 2012] -- ['Die Fremde', 2010] -- ['Halt auf freier Strecke', 2011] -- ['Homevideo', 2011] -- ['No such movie', 999] +- - ['Almanya - Willkommen in Deutschland', 2011] + - ['Barbara', 2012] + - ['Cloud Atlas', 2012] + - ['Die Fremde', 2010] + - ['Halt auf freier Strecke', 2011] + - ['Homevideo', 2011] + - ['No such movie', 999] ... -- a duplicate in the created index s:create_index('nodups', { type = 'tree', unique=true, parts = { 1, 'num'} }) @@ -747,13 +749,13 @@ s.index.year:alter({unique=true}) ... s.index.primary:select{} --- -- ['Almanya - Willkommen in Deutschland', 2011] -- ['Barbara', 2012] -- ['Cloud Atlas', 2012] -- ['Die Fremde', 2010] -- ['Halt auf freier Strecke', 2011] -- ['Homevideo', 2011] -- ['No such movie', 999] +- - ['Almanya - Willkommen in Deutschland', 2011] + - ['Barbara', 2012] + - ['Cloud Atlas', 2012] + - ['Die Fremde', 2010] + - ['Halt auf freier Strecke', 2011] + - ['Homevideo', 2011] + - ['No such movie', 999] ... box.space['_index']:update({s.n, s.index.year.id}, {{"=", 7, 'num'}}) --- diff --git a/test/box/call.result b/test/box/call.result index 8af0870f9ac984d71c49be151dc3aae9db943b66..334ccd8cdb592844954ef85becd7953abafa4393 100644 --- a/test/box/call.result +++ b/test/box/call.result @@ -229,7 +229,7 @@ insert into t0 values (2, 'test box delete') --- - [2, 'test box delete'] ... -call space:select(2) +call space:get(2) --- - [2, 'test box delete'] ... @@ -237,23 +237,35 @@ space:delete{2} --- - [2, 'test box delete'] ... -call space:select(2) +call space:get(2) --- ... insert into t0 values (2, 'test box.select()') --- - [2, 'test box.select()'] ... +call space:get(2) +--- +- [2, 'test box.select()'] +... call space:select(2) --- - [2, 'test box.select()'] ... -space:select{2} +space:get{2} --- - [2, 'test box.select()'] ... +space:select{2} +--- +- - [2, 'test box.select()'] +... +space:get{1} +--- +... space:select{1} --- +- [] ... call myreplace(2, 'hello', 'world') --- @@ -263,18 +275,30 @@ call myreplace(2, 'goodbye', 'universe') --- - [2, 'goodbye', 'universe'] ... +call space:get(2) +--- +- [2, 'goodbye', 'universe'] +... call space:select(2) --- - [2, 'goodbye', 'universe'] ... -space:select{2} +space:get{2} --- - [2, 'goodbye', 'universe'] ... +space:select{2} +--- +- - [2, 'goodbye', 'universe'] +... call myreplace(2) --- - [2] ... +call space:get(2) +--- +- [2] +... call space:select(2) --- - [2] @@ -300,6 +324,10 @@ space:update({3}, {{'=', 0, 4}, {'=', 1, 'new'}}) --- - [4, 'new', 2] ... +call space:get(4) +--- +- [4, 'new', 2] +... call space:select(4) --- - [4, 'new', 2] @@ -312,11 +340,15 @@ space:update({4}, {{'-', 2, 1}}) --- - [4, 'new', 2] ... +call space:get(4) +--- +- [4, 'new', 2] +... call space:select(4) --- - [4, 'new', 2] ... -function field_x(key, field_index) return space:select{key}[field_index] end +function field_x(key, field_index) return space:get(key)[field_index] end --- ... call field_x(4, 0) diff --git a/test/box/call.test.py b/test/box/call.test.py index 1ca1cf40cc770c9d00bef709f781a99d3596e7af..830b5ef80bed84a1a42cb89775049aa285cb7031 100644 --- a/test/box/call.test.py +++ b/test/box/call.test.py @@ -81,18 +81,24 @@ sql("call space:delete(2)") sql("call space:delete(2)") admin("space:delete{2}") sql("insert into t0 values (2, 'test box delete')") -sql("call space:select(2)") +sql("call space:get(2)") admin("space:delete{2}") -sql("call space:select(2)") +sql("call space:get(2)") sql("insert into t0 values (2, 'test box.select()')") +sql("call space:get(2)") sql("call space:select(2)") +admin("space:get{2}") admin("space:select{2}") +admin("space:get{1}") admin("space:select{1}") sql("call myreplace(2, 'hello', 'world')") sql("call myreplace(2, 'goodbye', 'universe')") +sql("call space:get(2)") sql("call space:select(2)") +admin("space:get{2}") admin("space:select{2}") sql("call myreplace(2)") +sql("call space:get(2)") sql("call space:select(2)") sql("call space:delete(2)") sql("call space:delete(2)") @@ -100,11 +106,13 @@ sql("call myinsert(3, 'old', 2)") # test that insert produces a duplicate key error sql("call myinsert(3, 'old', 2)") admin("space:update({3}, {{'=', 0, 4}, {'=', 1, 'new'}})") +sql("call space:get(4)") sql("call space:select(4)") admin("space:update({4}, {{'+', 2, 1}})") admin("space:update({4}, {{'-', 2, 1}})") +sql("call space:get(4)") sql("call space:select(4)") -admin("function field_x(key, field_index) return space:select{key}[field_index] end") +admin("function field_x(key, field_index) return space:get(key)[field_index] end") sql("call field_x(4, 0)") sql("call field_x(4, 1)") sql("call space:delete(4)") diff --git a/test/box/configuration.result b/test/box/configuration.result index 8c91826cea92bd063cd2fbdf18f6e6a36efd27ef..21ff122ca35955cc33b86d895b98f238f8cbf88c 100644 --- a/test/box/configuration.result +++ b/test/box/configuration.result @@ -44,15 +44,15 @@ box.space.tweedledum:insert{4, 8, 16} # Test insert from init.lua -box.space.tweedledum:select{1} +box.space.tweedledum:get(1) --- - [1, 2, 4, 8] ... -box.space.tweedledum:select(2) +box.space.tweedledum:get(2) --- - [2, 4, 8, 16] ... -box.space.tweedledum:select(4) +box.space.tweedledum:get(4) --- - [4, 8, 16] ... diff --git a/test/box/configuration.test.py b/test/box/configuration.test.py index 424dad1eae7a7e6893ec28cea9b5be7812114d20..5cfbdea9ed36068a72d7544efd6d00150bfaeba3 100644 --- a/test/box/configuration.test.py +++ b/test/box/configuration.test.py @@ -40,9 +40,9 @@ admin("box.space.tweedledum:insert{4, 8, 16}") print """ # Test insert from init.lua """ -admin("box.space.tweedledum:select{1}") -admin("box.space.tweedledum:select(2)") -admin("box.space.tweedledum:select(4)") +admin("box.space.tweedledum:get(1)") +admin("box.space.tweedledum:get(2)") +admin("box.space.tweedledum:get(4)") print """ # Test bug #1002272 diff --git a/test/box/errinj.result b/test/box/errinj.result index c95dc2929dc851e5aed44578ac8a69af4324d5b1..4a6af65688d39034fddd1c68af7375b2364ab3d3 100644 --- a/test/box/errinj.result +++ b/test/box/errinj.result @@ -25,14 +25,14 @@ box.errinj.set("some-injection") -- check error --- - 'error: can''t find error injection ''some-injection''' ... -space:select{222444} +space:get{222444} --- ... box.errinj.set("ERRINJ_TESTING", true) --- - ok ... -space:select{222444} +space:get{222444} --- - error: Error injection 'ERRINJ_TESTING' ... @@ -49,7 +49,7 @@ space:insert{1} --- - error: Failed to write to disk ... -space:select{1} +space:get{1} --- ... box.errinj.set("ERRINJ_WAL_IO", false) @@ -68,11 +68,11 @@ space:update(1, {{'=', 0, 2}}) --- - error: Failed to write to disk ... -space:select{1} +space:get{1} --- - [1] ... -space:select{2} +space:get{2} --- ... box.errinj.set("ERRINJ_WAL_IO", false) @@ -91,7 +91,7 @@ space:insert{1} --- - error: Failed to write to disk ... -space:select{1} +space:get{1} --- ... box.errinj.set("ERRINJ_WAL_ROTATE", false) @@ -110,11 +110,11 @@ space:update(1, {{'=', 0, 2}}) --- - error: Failed to write to disk ... -space:select{1} +space:get{1} --- - [1] ... -space:select{2} +space:get{2} --- ... box.errinj.set("ERRINJ_WAL_ROTATE", false) @@ -125,10 +125,10 @@ space:update(1, {{'=', 0, 2}}) --- - [2] ... -space:select{1} +space:get{1} --- ... -space:select{2} +space:get{2} --- - [2] ... diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua index 69f7fcb259e209e1004df0c90011612dfe0885ae..d3ba84ff8b9d185fb0c1515a23f66ffa6c3051e3 100644 --- a/test/box/errinj.test.lua +++ b/test/box/errinj.test.lua @@ -4,38 +4,38 @@ space:create_index('primary', { type = 'hash' }) box.errinj.info() box.errinj.set("some-injection", true) box.errinj.set("some-injection") -- check error -space:select{222444} +space:get{222444} box.errinj.set("ERRINJ_TESTING", true) -space:select{222444} +space:get{222444} box.errinj.set("ERRINJ_TESTING", false) -- Check how well we handle a failed log write box.errinj.set("ERRINJ_WAL_IO", true) space:insert{1} -space:select{1} +space:get{1} box.errinj.set("ERRINJ_WAL_IO", false) space:insert{1} box.errinj.set("ERRINJ_WAL_IO", true) space:update(1, {{'=', 0, 2}}) -space:select{1} -space:select{2} +space:get{1} +space:get{2} box.errinj.set("ERRINJ_WAL_IO", false) space:truncate() -- Check a failed log rotation box.errinj.set("ERRINJ_WAL_ROTATE", true) space:insert{1} -space:select{1} +space:get{1} box.errinj.set("ERRINJ_WAL_ROTATE", false) space:insert{1} box.errinj.set("ERRINJ_WAL_ROTATE", true) space:update(1, {{'=', 0, 2}}) -space:select{1} -space:select{2} +space:get{1} +space:get{2} box.errinj.set("ERRINJ_WAL_ROTATE", false) space:update(1, {{'=', 0, 2}}) -space:select{1} -space:select{2} +space:get{1} +space:get{2} box.errinj.set("ERRINJ_WAL_ROTATE", true) space:truncate() box.errinj.set("ERRINJ_WAL_ROTATE", false) diff --git a/test/box/errinj_index.result b/test/box/errinj_index.result index 3c936cfacc929c2e0d1cebd0e0652580c6222d30..76b497c56fa2bc0e6659dff4d4fd97e24a59d09d 100644 --- a/test/box/errinj_index.result +++ b/test/box/errinj_index.result @@ -11,7 +11,7 @@ for i = 1,10 do s:insert{i, i, 'test' .. i} end res = {} --- ... -for i = 1,10 do table.insert(res, s:select{i}) end +for i = 1,10 do table.insert(res, s:get{i}) end --- ... res @@ -53,7 +53,7 @@ box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} --- ... -for i = 1,10 do table.insert(res, s:select{i}) end +for i = 1,10 do table.insert(res, s:get{i}) end --- ... res @@ -93,7 +93,7 @@ box.errinj.set("ERRINJ_TREE_ALLOC", false) --- - ok ... -s:select{1} +s:get{1} --- ... box.errinj.set("ERRINJ_TREE_ALLOC", true) @@ -103,7 +103,7 @@ box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} --- ... -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end --- ... res @@ -136,7 +136,7 @@ box.errinj.set("ERRINJ_TREE_ALLOC", false) --- - ok ... -s:select{1} +s:get{1} --- ... box.errinj.set("ERRINJ_TREE_ALLOC", true) @@ -146,7 +146,7 @@ box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} --- ... -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end --- ... res @@ -182,7 +182,7 @@ for i = 2001,2500 do s:insert{i, i} end res = {} --- ... -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end --- ... res @@ -202,7 +202,7 @@ s:delete{8} res = {} --- ... -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end --- ... res @@ -217,7 +217,7 @@ res res = {} --- ... -for i = 2001,2010 do table.insert(res, (s:select{i})) end +for i = 2001,2010 do table.insert(res, (s:get{i})) end --- ... res diff --git a/test/box/errinj_index.test.lua b/test/box/errinj_index.test.lua index 1341c396f2cd4645b8c3b54c30e24001e4842e8c..d6743cbe8d5578519e0f474a5494e1b61a4a7711 100644 --- a/test/box/errinj_index.test.lua +++ b/test/box/errinj_index.test.lua @@ -5,7 +5,7 @@ s:create_index('primary') for i = 1,10 do s:insert{i, i, 'test' .. i} end res = {} -for i = 1,10 do table.insert(res, s:select{i}) end +for i = 1,10 do table.insert(res, s:get{i}) end res res = {} for t in s.index[0]:iterator() do table.insert(res, t) end @@ -14,7 +14,7 @@ res box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} -for i = 1,10 do table.insert(res, s:select{i}) end +for i = 1,10 do table.insert(res, s:get{i}) end res for i = 501,1000 do s:insert{i, i} end s:delete{1} @@ -24,11 +24,11 @@ res -- reserve memory for iterator in index. last insert may increase tree depth box.errinj.set("ERRINJ_TREE_ALLOC", false) -s:select{1} +s:get{1} box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end res for i = 1001,1500 do s:insert{i, i} end @@ -38,11 +38,11 @@ s.index[0]:iterator() -- reserve memory for iterator in index. last insert may increase tree depth -- (if rebalance was not initiated) box.errinj.set("ERRINJ_TREE_ALLOC", false) -s:select{1} +s:get{1} box.errinj.set("ERRINJ_TREE_ALLOC", true) res = {} -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end res for i = 1501,2000 do s:insert{i, i} end s:delete{3} @@ -52,14 +52,14 @@ box.errinj.set("ERRINJ_TREE_ALLOC", false) for i = 2001,2500 do s:insert{i, i} end res = {} -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end res s:delete{8} res = {} -for i = 1,10 do table.insert(res, (s:select{i})) end +for i = 1,10 do table.insert(res, (s:get{i})) end res res = {} -for i = 2001,2010 do table.insert(res, (s:select{i})) end +for i = 2001,2010 do table.insert(res, (s:get{i})) end res s:drop() diff --git a/test/box/fiber.result b/test/box/fiber.result index 12b60d4c5b5cee585a952de734f622a3968412ba..caffa03bf09e890e1ad13f44354e416419f4140a 100644 --- a/test/box/fiber.result +++ b/test/box/fiber.result @@ -579,9 +579,15 @@ box.fiber.resume(f) --- - error: 'fiber.resume(): the fiber is dead' ... -function r() box.fiber.yield(box.space.tweedledum:insert{0, 0, 1}) box.fiber.yield(box.space.tweedledum:select{0}) box.fiber.yield(box.space.tweedledum:truncate()) end +--# setopt delimiter ';' +function r() + box.fiber.yield(box.space.tweedledum:insert{0, 0, 1}) + box.fiber.yield(box.space.tweedledum:get{0}) + box.fiber.yield(box.space.tweedledum:truncate()) +end; --- ... +--# setopt delimiter '' f = box.fiber.create(r) --- ... diff --git a/test/box/fiber.test.lua b/test/box/fiber.test.lua index 094fbb434c769de7e145351291b58c7ca6fd2c88..ab9cb4ebcf7a8602c405bdbb47b9a3e5941523d2 100644 --- a/test/box/fiber.test.lua +++ b/test/box/fiber.test.lua @@ -208,7 +208,13 @@ function r() return box.fiber.sleep(0.01) end f = box.fiber.create(r) box.fiber.resume(f) box.fiber.resume(f) -function r() box.fiber.yield(box.space.tweedledum:insert{0, 0, 1}) box.fiber.yield(box.space.tweedledum:select{0}) box.fiber.yield(box.space.tweedledum:truncate()) end +--# setopt delimiter ';' +function r() + box.fiber.yield(box.space.tweedledum:insert{0, 0, 1}) + box.fiber.yield(box.space.tweedledum:get{0}) + box.fiber.yield(box.space.tweedledum:truncate()) +end; +--# setopt delimiter '' f = box.fiber.create(r) box.fiber.resume(f) box.fiber.resume(f) diff --git a/test/box/lua/fifo.lua b/test/box/lua/fifo.lua index bc2ba2b8c94a50fa50821a5783792f2d671fa834..08067f36a4536cd50202fbc19296a19f18c79b80 100644 --- a/test/box/lua/fifo.lua +++ b/test/box/lua/fifo.lua @@ -1,6 +1,6 @@ fifomax = 5 function find_or_create_fifo(space, name) - fifo = space:select{name} + fifo = space:get{name} if fifo == nil then fifo = {} for i = 1, fifomax do fifo[i] = 0 end diff --git a/test/box/misc.result b/test/box/misc.result index d6884ceccc4dea7150d10f1d559a606eb0700d1d..699fb8e706b907e03fe3e7701a3f4d9e8887ca5b 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -401,7 +401,7 @@ box.counter.inc(space.n, {1}) --- - 1 ... -space:select{1} +space:get{1} --- - [1, 1] ... @@ -413,7 +413,7 @@ box.counter.inc(space.n, {1}) --- - 3 ... -space:select{1} +space:get{1} --- - [1, 3] ... @@ -429,7 +429,7 @@ box.counter.dec(space.n, {1}) --- - 0 ... -space:select{1} +space:get{1} --- ... space:truncate() diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua index 6e2f96d8594a6cd8b7fc87706ed11e8ba0784b91..7c9ef513656eb8ff15833a630ab53070ab0283ac 100644 --- a/test/box/misc.test.lua +++ b/test/box/misc.test.lua @@ -131,14 +131,14 @@ bit.bor(1, 2) -- A test case for box.counter space = box.space.tweedledum box.counter.inc(space.n, {1}) -space:select{1} +space:get{1} box.counter.inc(space.n, {1}) box.counter.inc(space.n, {1}) -space:select{1} +space:get{1} box.counter.dec(space.n, {1}) box.counter.dec(space.n, {1}) box.counter.dec(space.n, {1}) -space:select{1} +space:get{1} space:truncate() dofile('fifo.lua') diff --git a/test/box/net.box.result b/test/box/net.box.result index 9a89eee9ab720d5ee6a4fb2f8b38e1a9d08379ca..dd3197dea4afb15a1e4cb56ac5f7e7a44e5aad63 100644 --- a/test/box/net.box.result +++ b/test/box/net.box.result @@ -29,10 +29,19 @@ space:insert{123, 'test1', 'test2'} ... space:select{123} --- +- - [123, 'test1', 'test2'] +... +space:get{123} +--- - [123, 'test1', 'test2'] ... -tuple = remote:select(space.n, 123) +remote:select(space.n, 123) --- +- - [123, 'test1', 'test2'] +... +remote:get(space.n, 123) +--- +- [123, 'test1', 'test2'] ... function test(...) return box.tuple.new({ 123, 456 }) end --- @@ -152,14 +161,30 @@ remote:call('test.a:b', 123) --- - - [1, 123] ... -box.space.tweedledum:select(123) +box.space.tweedledum:get(123) --- - [123, 'test1', 'test2'] ... -box.space.tweedledum:select({123}) +box.space.tweedledum:get({123}) --- - [123, 'test1', 'test2'] ... +remote:call('box.space.tweedledum:get', 123) +--- +- - [123, 'test1', 'test2'] +... +remote:call('box.space.tweedledum:get', {123}) +--- +- - [123, 'test1', 'test2'] +... +box.space.tweedledum:select(123) +--- +- - [123, 'test1', 'test2'] +... +box.space.tweedledum:select({123}) +--- +- - [123, 'test1', 'test2'] +... remote:call('box.space.tweedledum:select', 123) --- - - [123, 'test1', 'test2'] @@ -179,18 +204,6 @@ type(foo) --- - table ... -tuple ---- -- [123, 'test1', 'test2'] -... -type(tuple) ---- -- cdata -... -#tuple ---- -- 3 -... space:update(123, {{'=', 1, 'test1-updated'}}) --- - [123, 'test1-updated', 'test2'] @@ -211,26 +224,50 @@ remote:insert(space.n, {345, 'test1', 'test2'}) --- - [345, 'test1', 'test2'] ... -remote:select(space.n, {345}) +remote:get(space.n, {345}) --- - [345, 'test1', 'test2'] ... +remote:select(space.n, {345}) +--- +- - [345, 'test1', 'test2'] +... remote:call('box.space.tweedledum:select', 345) --- - - [345, 'test1', 'test2'] ... -space:select{345} +space:get{345} --- - [345, 'test1', 'test2'] ... +space:select{345} +--- +- - [345, 'test1', 'test2'] +... +remote:put(space.n, {345, 'test1-replaced', 'test3-replaced'}) +--- +- [345, 'test1-replaced', 'test3-replaced'] +... +space:get{345} +--- +- [345, 'test1-replaced', 'test3-replaced'] +... +space:select{345} +--- +- - [345, 'test1-replaced', 'test3-replaced'] +... remote:replace(space.n, {345, 'test1-replaced', 'test2-replaced'}) --- - [345, 'test1-replaced', 'test2-replaced'] ... -space:select{345} +space:get{345} --- - [345, 'test1-replaced', 'test2-replaced'] ... +space:select{345} +--- +- - [345, 'test1-replaced', 'test2-replaced'] +... space:eselect({}, { iterator = 'GE', limit = 1000 }) --- - - [123, 'test1-updated', 'test2-updated'] @@ -246,17 +283,29 @@ remote:eselect(space.n, 0, {}, { limit = 1000, iterator = 'GE' }) - - [123, 'test1-updated', 'test2-updated'] - [345, 'test1-replaced', 'test2-replaced'] ... +space:get{345} +--- +- [345, 'test1-replaced', 'test2-replaced'] +... space:select{345} --- +- - [345, 'test1-replaced', 'test2-replaced'] +... +remote:get(space.n, {345}) +--- - [345, 'test1-replaced', 'test2-replaced'] ... remote:select(space.n, {345}) --- +- - [345, 'test1-replaced', 'test2-replaced'] +... +remote:timeout(0.5):get(space.n, {345}) +--- - [345, 'test1-replaced', 'test2-replaced'] ... remote:timeout(0.5):select(space.n, {345}) --- -- [345, 'test1-replaced', 'test2-replaced'] +- - [345, 'test1-replaced', 'test2-replaced'] ... box.net.self:insert(space.n, {12345, 'test1', 'test2'}) --- @@ -356,14 +405,22 @@ box.time() - pstart < 0.5 --- - true ... -box.net.self.rpc.box.space.tweedledum.index.primary:select(12345) +box.net.self.rpc.box.space.tweedledum.index.primary:get(12345) --- - - [12345, 'test11', 'test2'] ... +box.net.self.rpc.box.space.tweedledum.index.primary:select(12345) +--- +- - - [12345, 'test11', 'test2'] +... remote.rpc.box.space.tweedledum.index.primary:eselect(12345) --- - - [12345, 'test11', 'test2'] ... +remote.rpc.box.space.tweedledum.index.primary:get(12345) +--- +- - [12345, 'test11', 'test2'] +... remote.rpc.box.space.tweedledum.index.primary:select(12345) --- - - [12345, 'test11', 'test2'] @@ -374,11 +431,11 @@ remote:close() ... remote:close() --- -- error: '[string "-- box_net.lua (internal file)..."]:506: box.net.box: already closed' +- error: '[string "-- box_net.lua (internal file)..."]:558: box.net.box: already closed' ... remote:ping() --- -- error: '[string "-- box_net.lua (internal file)..."]:511: box.net.box: connection +- error: '[string "-- box_net.lua (internal file)..."]:563: box.net.box: connection was closed' ... space:drop() diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua index 67f30e898a1afa34c880576babb89d39febf2ff6..01a55fa75071d8c5437422169140fe25d24b413f 100644 --- a/test/box/net.box.test.lua +++ b/test/box/net.box.test.lua @@ -7,7 +7,9 @@ remote:ping() box.net.box.ping(remote) space:insert{123, 'test1', 'test2'} space:select{123} -tuple = remote:select(space.n, 123) +space:get{123} +remote:select(space.n, 123) +remote:get(space.n, 123) function test(...) return box.tuple.new({ 123, 456 }) end f, a = box.call_loadproc('test') @@ -47,7 +49,10 @@ type(a) remote:call('test.a:b', 123) - +box.space.tweedledum:get(123) +box.space.tweedledum:get({123}) +remote:call('box.space.tweedledum:get', 123) +remote:call('box.space.tweedledum:get', {123}) box.space.tweedledum:select(123) box.space.tweedledum:select({123}) @@ -58,10 +63,6 @@ slf, foo = box.call_loadproc('box.net.self:select') type(slf) type(foo) -tuple -type(tuple) -#tuple - space:update(123, {{'=', 1, 'test1-updated'}}) remote:update(space.n, 123, {{'=', 2, 'test2-updated'}}) @@ -69,18 +70,28 @@ space:insert{123, 'test1', 'test2'} remote:insert(space.n, {123, 'test1', 'test2'}) remote:insert(space.n, {345, 'test1', 'test2'}) +remote:get(space.n, {345}) remote:select(space.n, {345}) remote:call('box.space.tweedledum:select', 345) +space:get{345} +space:select{345} + +remote:put(space.n, {345, 'test1-replaced', 'test3-replaced'}) +space:get{345} space:select{345} remote:replace(space.n, {345, 'test1-replaced', 'test2-replaced'}) +space:get{345} space:select{345} space:eselect({}, { iterator = 'GE', limit = 1000 }) box.net.self:eselect(space.n, 0, {}, { iterator = 'GE', limit = 1000 }) remote:eselect(space.n, 0, {}, { limit = 1000, iterator = 'GE' }) +space:get{345} space:select{345} +remote:get(space.n, {345}) remote:select(space.n, {345}) +remote:timeout(0.5):get(space.n, {345}) remote:timeout(0.5):select(space.n, {345}) @@ -128,8 +139,10 @@ box.time() - pstart < 0.5 +box.net.self.rpc.box.space.tweedledum.index.primary:get(12345) box.net.self.rpc.box.space.tweedledum.index.primary:select(12345) remote.rpc.box.space.tweedledum.index.primary:eselect(12345) +remote.rpc.box.space.tweedledum.index.primary:get(12345) remote.rpc.box.space.tweedledum.index.primary:select(12345) remote:close() diff --git a/test/box/on_replace.result b/test/box/on_replace.result index a3bf532ce2d639ef5b9fdb37f8a25ca561447482..3de8a9e9edc2f0e325116e016d017b02f12d165b 100644 --- a/test/box/on_replace.result +++ b/test/box/on_replace.result @@ -30,7 +30,7 @@ ts:insert{1, 'b', 'c'} --- - error: '[string "function fail(old_tuple, new_tuple) error(''te..."]:1: test' ... -ts:select{1} +ts:get{1} --- ... ts:on_replace(nil, fail) @@ -40,7 +40,7 @@ ts:insert{1, 'b', 'c'} --- - [1, 'b', 'c'] ... -ts:select{1} +ts:get{1} --- - [1, 'b', 'c'] ... @@ -54,7 +54,7 @@ ts:insert{2, 'b', 'c'} --- - error: '[string "function fail(old_tuple, new_tuple) error(''ab..."]:1: abc' ... -ts:select{2} +ts:get{2} --- ... function save_out(told, tnew) o = told n = tnew end diff --git a/test/box/on_replace.test.lua b/test/box/on_replace.test.lua index 329f7f112cc5bbdaf76bd8f9e0a34c1bb2366c12..6a79ba6337b24e237ffa776c9ed19ebaa0c5ef76 100644 --- a/test/box/on_replace.test.lua +++ b/test/box/on_replace.test.lua @@ -10,18 +10,18 @@ function fail(old_tuple, new_tuple) error('test') end ts:on_replace(fail) ts:insert{1, 'b', 'c'} -ts:select{1} +ts:get{1} ts:on_replace(nil, fail) ts:insert{1, 'b', 'c'} -ts:select{1} +ts:get{1} function fail(old_tuple, new_tuple) error('abc') end ts:on_replace(fail) ts:insert{2, 'b', 'c'} -ts:select{2} +ts:get{2} function save_out(told, tnew) o = told n = tnew end ts:on_replace(save_out, fail) diff --git a/test/box/select.result b/test/box/select.result index 9fa2ee70bf885bce9290d7cc81f149134b67d540..87fc606668d19ee54f46a60a9a8ff2ce33af9794 100644 --- a/test/box/select.result +++ b/test/box/select.result @@ -7,6 +7,9 @@ s = box.schema.create_space('eselect', { temporary = true }) index = s:create_index('primary', { type = 'tree' }) --- ... +s:create_index('second', { type = 'tree', unique = true, parts = {1, 'num', 0, 'num'}}) +--- +... for i = 1, 20 do s:insert({ i, 1, 2, 3 }) end --- ... @@ -105,6 +108,432 @@ s:eselect(2) --- - [2, 1, 2, 3] ... +-------------------------------------------------------------------------------- +-- get tests +-------------------------------------------------------------------------------- +s.index[0]:get() +--- +- error: More than one tuple found by get() +... +s.index[0]:get({}) +--- +- error: More than one tuple found by get() +... +s.index[0]:get(nil) +--- +- error: More than one tuple found by get() +... +s.index[0]:get(1) +--- +- [1, 1, 2, 3] +... +s.index[0]:get({1}) +--- +- [1, 1, 2, 3] +... +s.index[0]:get({1, 2}) +--- +- error: Invalid key part count (expected [0..1], got 2) +... +s.index[0]:get(0) +--- +... +s.index[0]:get({0}) +--- +... +s.index[0]:get("0") +--- +- error: 'Supplied key type of part 0 does not match index part type: expected NUM' +... +s.index[0]:get({"0"}) +--- +- error: 'Supplied key type of part 0 does not match index part type: expected NUM' +... +s.index[1]:get(1) +--- +- error: More than one tuple found by get() +... +s.index[1]:get({1}) +--- +- error: More than one tuple found by get() +... +s.index[1]:get({1, 2}) +--- +- [2, 1, 2, 3] +... +-------------------------------------------------------------------------------- +-- select tests +-------------------------------------------------------------------------------- +s.index[0]:select() +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select({}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select(nil) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select({}, {iterator = 'ALL'}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = box.index.ALL }) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select({}, {iterator = box.index.ALL, limit = 10}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = box.index.ALL, limit = 0}) +--- +- [] +... +s.index[0]:select({}, {iterator = 'ALL', limit = 1, offset = 15}) +--- +- - [16, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = 'ALL', limit = 20, offset = 15}) +--- +- - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = box.index.EQ}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select({}, {iterator = 'EQ'}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = 'REQ'}) +--- +- - [20, 1, 2, 3] + - [19, 1, 2, 3] + - [18, 1, 2, 3] + - [17, 1, 2, 3] + - [16, 1, 2, 3] + - [15, 1, 2, 3] + - [14, 1, 2, 3] + - [13, 1, 2, 3] + - [12, 1, 2, 3] + - [11, 1, 2, 3] + - [10, 1, 2, 3] + - [9, 1, 2, 3] + - [8, 1, 2, 3] + - [7, 1, 2, 3] + - [6, 1, 2, 3] + - [5, 1, 2, 3] + - [4, 1, 2, 3] + - [3, 1, 2, 3] + - [2, 1, 2, 3] + - [1, 1, 2, 3] +... +s.index[0]:select({}, {iterator = box.index.REQ}) +--- +- - [20, 1, 2, 3] + - [19, 1, 2, 3] + - [18, 1, 2, 3] + - [17, 1, 2, 3] + - [16, 1, 2, 3] + - [15, 1, 2, 3] + - [14, 1, 2, 3] + - [13, 1, 2, 3] + - [12, 1, 2, 3] + - [11, 1, 2, 3] + - [10, 1, 2, 3] + - [9, 1, 2, 3] + - [8, 1, 2, 3] + - [7, 1, 2, 3] + - [6, 1, 2, 3] + - [5, 1, 2, 3] + - [4, 1, 2, 3] + - [3, 1, 2, 3] + - [2, 1, 2, 3] + - [1, 1, 2, 3] +... +s.index[0]:select(nil, {iterator = 'EQ', limit = 2, offset = 1}) +--- +- - [2, 1, 2, 3] + - [3, 1, 2, 3] +... +s.index[0]:select({}, {iterator = box.index.REQ, limit = 2, offset = 1}) +--- +- - [19, 1, 2, 3] + - [18, 1, 2, 3] +... +s.index[0]:select(1) +--- +- - [1, 1, 2, 3] +... +s.index[0]:select({1}) +--- +- - [1, 1, 2, 3] +... +s.index[0]:select({1, 2}) +--- +- error: Invalid key part count (expected [0..1], got 2) +... +s.index[0]:select(0) +--- +- [] +... +s.index[0]:select({0}) +--- +- [] +... +s.index[0]:select("0") +--- +- error: 'Supplied key type of part 0 does not match index part type: expected NUM' +... +s.index[0]:select({"0"}) +--- +- error: 'Supplied key type of part 0 does not match index part type: expected NUM' +... +s.index[1]:select(1) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[1]:select({1}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[1]:select({1}, {limit = 2}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] +... +s.index[1]:select(1, {iterator = 'EQ'}) +--- +- - [1, 1, 2, 3] + - [2, 1, 2, 3] + - [3, 1, 2, 3] + - [4, 1, 2, 3] + - [5, 1, 2, 3] + - [6, 1, 2, 3] + - [7, 1, 2, 3] + - [8, 1, 2, 3] + - [9, 1, 2, 3] + - [10, 1, 2, 3] + - [11, 1, 2, 3] + - [12, 1, 2, 3] + - [13, 1, 2, 3] + - [14, 1, 2, 3] + - [15, 1, 2, 3] + - [16, 1, 2, 3] + - [17, 1, 2, 3] + - [18, 1, 2, 3] + - [19, 1, 2, 3] + - [20, 1, 2, 3] +... +s.index[1]:select({1}, {iterator = box.index.EQ, offset = 16, limit = 2}) +--- +- - [17, 1, 2, 3] + - [18, 1, 2, 3] +... +s.index[1]:select({1}, {iterator = box.index.REQ, offset = 16, limit = 2 }) +--- +- - [4, 1, 2, 3] + - [3, 1, 2, 3] +... +s.index[1]:select({1, 2}, {iterator = 'EQ'}) +--- +- - [2, 1, 2, 3] +... +s.index[1]:select({1, 2}, {iterator = box.index.REQ}) +--- +- - [2, 1, 2, 3] +... +s.index[1]:select({1, 2}) +--- +- - [2, 1, 2, 3] +... s:drop() --- ... diff --git a/test/box/select.test.lua b/test/box/select.test.lua index c94e25d74e5bd06f1a4d65d950b997f3b15f8833..2fd3018a1196312e6d8b4fdeee03540588692e13 100644 --- a/test/box/select.test.lua +++ b/test/box/select.test.lua @@ -2,6 +2,7 @@ print('eselect') s = box.schema.create_space('eselect', { temporary = true }) index = s:create_index('primary', { type = 'tree' }) +s:create_index('second', { type = 'tree', unique = true, parts = {1, 'num', 0, 'num'}}) for i = 1, 20 do s:insert({ i, 1, 2, 3 }) end @@ -24,4 +25,63 @@ s.index[0]:eselect(1, { iterator = 'GE', grep = function(t) if math.fmod(t[0], 2 s:eselect(2) +-------------------------------------------------------------------------------- +-- get tests +-------------------------------------------------------------------------------- + +s.index[0]:get() +s.index[0]:get({}) +s.index[0]:get(nil) +s.index[0]:get(1) +s.index[0]:get({1}) +s.index[0]:get({1, 2}) +s.index[0]:get(0) +s.index[0]:get({0}) +s.index[0]:get("0") +s.index[0]:get({"0"}) + +s.index[1]:get(1) +s.index[1]:get({1}) +s.index[1]:get({1, 2}) + +-------------------------------------------------------------------------------- +-- select tests +-------------------------------------------------------------------------------- + +s.index[0]:select() +s.index[0]:select({}) +s.index[0]:select(nil) +s.index[0]:select({}, {iterator = 'ALL'}) +s.index[0]:select(nil, {iterator = box.index.ALL }) +s.index[0]:select({}, {iterator = box.index.ALL, limit = 10}) +s.index[0]:select(nil, {iterator = box.index.ALL, limit = 0}) +s.index[0]:select({}, {iterator = 'ALL', limit = 1, offset = 15}) +s.index[0]:select(nil, {iterator = 'ALL', limit = 20, offset = 15}) + +s.index[0]:select(nil, {iterator = box.index.EQ}) +s.index[0]:select({}, {iterator = 'EQ'}) +s.index[0]:select(nil, {iterator = 'REQ'}) +s.index[0]:select({}, {iterator = box.index.REQ}) + +s.index[0]:select(nil, {iterator = 'EQ', limit = 2, offset = 1}) +s.index[0]:select({}, {iterator = box.index.REQ, limit = 2, offset = 1}) + +s.index[0]:select(1) +s.index[0]:select({1}) +s.index[0]:select({1, 2}) +s.index[0]:select(0) +s.index[0]:select({0}) +s.index[0]:select("0") +s.index[0]:select({"0"}) + +s.index[1]:select(1) +s.index[1]:select({1}) +s.index[1]:select({1}, {limit = 2}) +s.index[1]:select(1, {iterator = 'EQ'}) +s.index[1]:select({1}, {iterator = box.index.EQ, offset = 16, limit = 2}) +s.index[1]:select({1}, {iterator = box.index.REQ, offset = 16, limit = 2 }) +s.index[1]:select({1, 2}, {iterator = 'EQ'}) +s.index[1]:select({1, 2}, {iterator = box.index.REQ}) +s.index[1]:select({1, 2}) + s:drop() diff --git a/test/box/session.result b/test/box/session.result index 7894e39af5d8d14ecb3bb451bc260d748b147e54..ad5be7bc5292a7586e37f170d9deab12eb56daf0 100644 --- a/test/box/session.result +++ b/test/box/session.result @@ -166,7 +166,7 @@ box.session.on_disconnect(audit_disconnect) ... --# create connection con_three to default --# set connection con_three -space:select{box.session.id()}[0] == box.session.id() +space:get{box.session.id()}[0] == box.session.id() --- - true ... diff --git a/test/box/session.test.lua b/test/box/session.test.lua index aaed261cbbf39b6b919ead798e434c6c2a6f4501..41323d4c0e31d8b6ca5fc73c71cb844170b67d96 100644 --- a/test/box/session.test.lua +++ b/test/box/session.test.lua @@ -69,7 +69,7 @@ box.session.on_disconnect(audit_disconnect) --# create connection con_three to default --# set connection con_three -space:select{box.session.id()}[0] == box.session.id() +space:get{box.session.id()}[0] == box.session.id() --# set connection default --# drop connection con_three diff --git a/test/box/temp_spaces.result b/test/box/temp_spaces.result index 0b4af59995369eeb4fe5297cb3b72d80c36b28f6..4b068703634f820feddc1309fd3aebc6bc532a7e 100644 --- a/test/box/temp_spaces.result +++ b/test/box/temp_spaces.result @@ -42,7 +42,7 @@ s:insert{1, 2, 3} --- - [1, 2, 3] ... -s:select{1} +s:get{1} --- - [1, 2, 3] ... @@ -103,7 +103,7 @@ s.temporary --- - true ... -s:select{1} +s:get{1} --- ... s:insert{1, 2, 3} diff --git a/test/box/temp_spaces.test.lua b/test/box/temp_spaces.test.lua index 348962c75d64aef02dfb552bf7fa68ff2946e059..bb87a026c3da62cf2ae3f5baad6f4b88630334dd 100644 --- a/test/box/temp_spaces.test.lua +++ b/test/box/temp_spaces.test.lua @@ -18,7 +18,7 @@ s = box.schema.create_space('t', { temporary = true }) s:create_index('primary', { type = 'hash' }) s:insert{1, 2, 3} -s:select{1} +s:get{1} s:len() box.space[box.schema.SPACE_ID]:update(s.n, {{'=', 3, 'temporary'}}) @@ -40,7 +40,7 @@ s.temporary box.space[box.schema.SPACE_ID]:update(s.n, {{'=', 3, 'temporary'}}) s.temporary -s:select{1} +s:get{1} s:insert{1, 2, 3} box.space[box.schema.SPACE_ID]:update(s.n, {{'=', 3, 'temporary'}}) diff --git a/test/box/tuple.result b/test/box/tuple.result index c4d644269499101fdbed5afb21411a268cfaa3b9..83ab083eb2b9ad8db9b32e02f932d63f7b826fae 100644 --- a/test/box/tuple.result +++ b/test/box/tuple.result @@ -282,7 +282,7 @@ space:replace{777, { 'a', 'b', 'c', {'d', 'e', t}}} - [777, ['a', 'b', 'c', ['d', 'e', [0, 777, '0', '1', '2', '3']]]] ... -- A test case for tuple:totable() method -t=space:select{777}:totable() +t=space:get{777}:totable() --- ... t[2], t[3], t[4], t[5] diff --git a/test/box/tuple.test.lua b/test/box/tuple.test.lua index e2d0912067177bf31afcbe685993815dbbcb339e..5ac99a7087040cc3074da6d0c712eda25083b4cb 100644 --- a/test/box/tuple.test.lua +++ b/test/box/tuple.test.lua @@ -88,7 +88,7 @@ t space:replace(t) space:replace{777, { 'a', 'b', 'c', {'d', 'e', t}}} -- A test case for tuple:totable() method -t=space:select{777}:totable() +t=space:get{777}:totable() t[2], t[3], t[4], t[5] space:truncate() -- A test case for Bug#1119389 '(lbox_tuple_index) crashes on 'nil' argument' diff --git a/test/box/xlog.result b/test/box/xlog.result index d59b95353febf6a4fb9c2ae1a360c82edd1728b7..ed153a977dfdf8b5b2a55dde83badf3301c70507 100644 --- a/test/box/xlog.result +++ b/test/box/xlog.result @@ -39,11 +39,11 @@ box.space[0]:insert{3, 'third tuple'} A test case for https://bugs.launchpad.net/tarantool/+bug/1052018 panic_on_wal_error doens't work for duplicate key errors -box.space[0]:select{1} +box.space[0]:get{1} --- - [1, 'First record'] ... -box.space[0]:select{2} +box.space[0]:get{2} --- - [2, 'Second record'] ... diff --git a/test/box/xlog.test.py b/test/box/xlog.test.py index 096cb249d52f376a583445d1b3bd22c7ccde395f..e6d69a0865e83f5b8d862b309c5490e76e9a1fe6 100644 --- a/test/box/xlog.test.py +++ b/test/box/xlog.test.py @@ -120,8 +120,8 @@ shutil.copy(abspath("box/dup_key1.xlog"), shutil.copy(abspath("box/dup_key2.xlog"), os.path.join(server.vardir, "00000000000000000004.xlog")) server.start() -admin("box.space[0]:select{1}") -admin("box.space[0]:select{2}") +admin("box.space[0]:get{1}") +admin("box.space[0]:get{2}") admin("#box.space[0]") # cleanup diff --git a/test/replication/consistent.result b/test/replication/consistent.result index d3befef6fa3ea9ceda094fe0f5681e1fa2e515f9..6a2cf544bd9d540367688c5b682a723be3b7b3e0 100644 --- a/test/replication/consistent.result +++ b/test/replication/consistent.result @@ -24,7 +24,7 @@ do box.fiber.sleep(0.001) end for i = _begin, _end do - table.insert(a, box.space[0]:select{i}) + table.insert(a, box.space[0]:get{i}) end return unpack(a) end diff --git a/test/replication/consistent.test.lua b/test/replication/consistent.test.lua index e8cf28cb698ba3cdcd17c205dd1ab58a8ecbd7fc..8b4aacbec2e2e249123e4f0f59e50a0bae03efdd 100644 --- a/test/replication/consistent.test.lua +++ b/test/replication/consistent.test.lua @@ -25,7 +25,7 @@ do box.fiber.sleep(0.001) end for i = _begin, _end do - table.insert(a, box.space[0]:select{i}) + table.insert(a, box.space[0]:get{i}) end return unpack(a) end diff --git a/test/replication/hot_standby.result b/test/replication/hot_standby.result index e49c47c4187e030a2adda8687988627040e140a4..36b6d725d1d73bfa253b624e6a9182cf0bfe5a40 100644 --- a/test/replication/hot_standby.result +++ b/test/replication/hot_standby.result @@ -26,7 +26,7 @@ do function _select(_begin, _end) local a = {} for i = _begin, _end do - table.insert(a, box.space['tweedledum']:select{i}) + table.insert(a, box.space['tweedledum']:get{i}) end return unpack(a) end diff --git a/test/replication/hot_standby.test.lua b/test/replication/hot_standby.test.lua index c60722fd264084af765b3201621d09cb7e1f2dfb..117a24be93f2856d9e297e26ba6cfd6f629212bf 100644 --- a/test/replication/hot_standby.test.lua +++ b/test/replication/hot_standby.test.lua @@ -27,7 +27,7 @@ do function _select(_begin, _end) local a = {} for i = _begin, _end do - table.insert(a, box.space['tweedledum']:select{i}) + table.insert(a, box.space['tweedledum']:get{i}) end return unpack(a) end diff --git a/test/replication/init_storage.result b/test/replication/init_storage.result index 7e15eb5b1ee8f6cae084dd7809cc7360437a59e6..91321a0d130e981dc5a8c2f6dd66d714176fa542 100644 --- a/test/replication/init_storage.result +++ b/test/replication/init_storage.result @@ -27,79 +27,79 @@ replica test 2 (must be ok) space = box.space.test --- ... -space:select{1} +space:get{1} --- - [1, 1] ... -space:select{2} +space:get{2} --- - [2, 4] ... -space:select{3} +space:get{3} --- - [3, 9] ... -space:select{4} +space:get{4} --- - [4, 16] ... -space:select{5} +space:get{5} --- - [5, 25] ... -space:select{6} +space:get{6} --- - [6, 36] ... -space:select{7} +space:get{7} --- - [7, 49] ... -space:select{8} +space:get{8} --- - [8, 64] ... -space:select{9} +space:get{9} --- - [9, 81] ... -space:select{10} +space:get{10} --- - [10, 1000] ... -space:select{11} +space:get{11} --- - [11, 1331] ... -space:select{12} +space:get{12} --- - [12, 1728] ... -space:select{13} +space:get{13} --- - [13, 2197] ... -space:select{14} +space:get{14} --- - [14, 2744] ... -space:select{15} +space:get{15} --- - [15, 3375] ... -space:select{16} +space:get{16} --- - [16, 4096] ... -space:select{17} +space:get{17} --- - [17, 4913] ... -space:select{18} +space:get{18} --- - [18, 5832] ... -space:select{19} +space:get{19} --- - [19, 6859] ... diff --git a/test/replication/init_storage.test.py b/test/replication/init_storage.test.py index 95d5a53bd425ee20c7b0dd6fdc4e193b82215063..3761a757777b0c2f9fc71f241884e085a1c830df 100644 --- a/test/replication/init_storage.test.py +++ b/test/replication/init_storage.test.py @@ -46,7 +46,7 @@ replica.deploy() replica.admin('space = box.space.test'); replica.wait_lsn(lsn) for i in range(1, 20): - replica.admin('space:select{%d}' % i) + replica.admin('space:get{%d}' % i) replica.stop() replica.cleanup(True) diff --git a/test/wal/lua.result b/test/wal/lua.result index 46aa6065ab56a23c43d1fe66dd7f24b57d10ae57..181dc461e4311e8c4edf510250c931ea3fc83fef 100644 --- a/test/wal/lua.result +++ b/test/wal/lua.result @@ -37,9 +37,8 @@ space:truncate() for i = 1, 100000, 1 do space:insert{tostring(i), i} end --- ... -local t1 = {space.index['secondary']:select{}} +local t1 = space.index['secondary']:select({}, { limit = 100000 }) --- -- error: stack overflow ... space:drop() --- diff --git a/test/wal/lua.test.lua b/test/wal/lua.test.lua index 6c29dba3b3bf96c88660b2f95a71178b71912d59..a7e6e59b91be2dd15eaf8ec7d45da879d453c403 100644 --- a/test/wal/lua.test.lua +++ b/test/wal/lua.test.lua @@ -27,7 +27,7 @@ space:truncate() -- 5.4 -- for i = 1, 100000, 1 do space:insert{tostring(i), i} end -local t1 = {space.index['secondary']:select{}} +local t1 = space.index['secondary']:select({}, { limit = 100000 }) space:drop() -- diff --git a/test/wal/oom.result b/test/wal/oom.result index 54f21b9a0c843199c3b6d258aaee319e540cd745..96862214575d921448a496d056f1d5f66066fd08 100644 --- a/test/wal/oom.result +++ b/test/wal/oom.result @@ -50,23 +50,23 @@ space:len() --- - 219 ... -space.index['primary']:select{0} +space.index['primary']:get{0} --- - [0, 'test'] ... -space.index['primary']:select{5} +space.index['primary']:get{5} --- - [5, 'testtesttesttesttesttest'] ... -space.index['primary']:select{9} +space.index['primary']:get{9} --- - [9, 'testtesttesttesttesttesttesttesttesttest'] ... -space.index['primary']:select{11} +space.index['primary']:get{11} --- - [11, 'testtesttesttesttesttesttesttesttesttesttesttest'] ... -space.index['primary']:select{15} +space.index['primary']:get{15} --- - [15, 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest'] ... @@ -148,7 +148,7 @@ space:insert{0, 'test'} --- - [0, 'test'] ... -space.index['primary']:select{0} +space.index['primary']:get{0} --- - [0, 'test'] ... diff --git a/test/wal/oom.test.lua b/test/wal/oom.test.lua index 6b30d09d21f5063759a59d1712cfdec870de3f5e..bb949f1917330d7ac38b9d787abc4876fcdf2a31 100644 --- a/test/wal/oom.test.lua +++ b/test/wal/oom.test.lua @@ -22,11 +22,11 @@ while true do end; --# setopt delimiter '' space:len() -space.index['primary']:select{0} -space.index['primary']:select{5} -space.index['primary']:select{9} -space.index['primary']:select{11} -space.index['primary']:select{15} +space.index['primary']:get{0} +space.index['primary']:get{5} +space.index['primary']:get{9} +space.index['primary']:get{11} +space.index['primary']:get{15} -- check that iterators work i = 0 t = {} @@ -42,5 +42,5 @@ end; t space:truncate() space:insert{0, 'test'} -space.index['primary']:select{0} +space.index['primary']:get{0} space:drop() diff --git a/test/wal/wal_mode.result b/test/wal/wal_mode.result index a75bb8c7e103c30ea7454d7cae147cc4d185029c..5e6f49f044e58952f226c02d857723826c26504c 100644 --- a/test/wal/wal_mode.result +++ b/test/wal/wal_mode.result @@ -20,19 +20,19 @@ space:insert{3} --- - [3] ... -space.index['primary']:select(1) +space.index['primary']:get(1) --- - [1] ... -space.index['primary']:select(2) +space.index['primary']:get(2) --- - [2] ... -space.index['primary']:select(3) +space.index['primary']:get(3) --- - [3] ... -space.index['primary']:select(4) +space.index['primary']:get(4) --- ... box.snapshot() diff --git a/test/wal/wal_mode.test.lua b/test/wal/wal_mode.test.lua index f1b6db2297e8a7706552848c1ee536644ebf684c..4fad8a33e751d19b3763591f129db3c7c4c98992 100644 --- a/test/wal/wal_mode.test.lua +++ b/test/wal/wal_mode.test.lua @@ -4,10 +4,10 @@ space:create_index('primary', { type = 'hash' }) space:insert{1} space:insert{2} space:insert{3} -space.index['primary']:select(1) -space.index['primary']:select(2) -space.index['primary']:select(3) -space.index['primary']:select(4) +space.index['primary']:get(1) +space.index['primary']:get(2) +space.index['primary']:get(3) +space.index['primary']:get(4) box.snapshot() box.snapshot() space:truncate()