Skip to content

Select with merger fails to process errors from storage #271

@DifferentialOrange

Description

@DifferentialOrange

Tarantool 2.10.0-beta2

If storage returns nil, err on a select request error, merger fails to process it trying to subscribe parsed buffer:

{
   "class_name":"SelectError",
   "err":"...Development\/github\/tarantool\/crud\/crud\/select\/merger.lua:118: 'void *' has no member named 'stats'",
   "stack":"stack traceback:\n\t...ment\/github\/tarantool\/crud\/crud\/select\/compat\/select.lua:288: in function <...ment\/github\/tarantool\/crud\/crud\/select\/compat\/select.lua:239>\n\t[C]: in function 'xpcall'\n\t...\/github\/tarantool\/crud\/.rocks\/share\/tarantool\/errors.lua:145: in function <...\/github\/tarantool\/crud\/.rocks\/share\/tarantool\/errors.lua:139>\n\t[C]: in function 'pcall'\n\t...ev\/Development\/github\/tarantool\/crud\/crud\/stats\/init.lua:373: in function <...ev\/Development\/github\/tarantool\/crud\/crud\/stats\/init.lua:364>\n\t[C]: at 0x55dd064efc50\nduring wrapped call\nstack traceback:\n\t...t\/github\/tarantool\/crud\/\/\/test\/performance\/perf_test.lua:893: in function <...t\/github\/tarantool\/crud\/\/\/test\/performance\/perf_test.lua:881>",
   "str":"SelectError: ...Development\/github\/tarantool\/crud\/crud\/select\/merger.lua:118: 'void *' has no member named 'stats'"
}
Reproducer example

diff --git a/crud/select.lua b/crud/select.lua
index b0d1ef9..b9a9aeb 100644
--- a/crud/select.lua
+++ b/crud/select.lua
@@ -40,50 +40,52 @@ local function select_on_storage(space_name, index_id, conditions, opts)
         field_names = '?table',
     })
 
-    local space = box.space[space_name]
-    if space == nil then
-        return nil, SelectError:new("Space %q doesn't exist", space_name)
-    end
-
-    local index = space.index[index_id]
-    if index == nil then
-        return nil, SelectError:new("Index with ID %s doesn't exist", index_id)
-    end
-
-    local filter_func, err = select_filters.gen_func(space, conditions, {
-        tarantool_iter = opts.tarantool_iter,
-        scan_condition_num = opts.scan_condition_num,
-    })
-    if err ~= nil then
-        return nil, SelectError:new("Failed to generate tuples filter: %s", err)
-    end
-
-    -- execute select
-    local resp, err = select_executor.execute(space, index, filter_func, {
-        scan_value = opts.scan_value,
-        after_tuple = opts.after_tuple,
-        tarantool_iter = opts.tarantool_iter,
-        limit = opts.limit,
-    })
-    if err ~= nil then
-        return nil, SelectError:new("Failed to execute select: %s", err)
-    end
-
-    local cursor
-    if resp.tuples_fetched < opts.limit or opts.limit == 0 then
-        cursor = {is_end = true}
-    else
-        cursor = make_cursor(resp.tuples)
-    end
-
-    cursor.stats = {
-        tuples_lookup = resp.tuples_lookup,
-        tuples_fetched = resp.tuples_fetched,
-    }
-
-    -- getting tuples with user defined fields (if `fields` option is specified)
-    -- and fields that are needed for comparison on router (primary key + scan key)
-    return cursor, schema.filter_tuples_fields(resp.tuples, opts.field_names)
+    return nil, SelectError:new("I want to check something")
+
+    -- local space = box.space[space_name]
+    -- if space == nil then
+    --     return nil, SelectError:new("Space %q doesn't exist", space_name)
+    -- end
+
+    -- local index = space.index[index_id]
+    -- if index == nil then
+    --     return nil, SelectError:new("Index with ID %s doesn't exist", index_id)
+    -- end
+
+    -- local filter_func, err = select_filters.gen_func(space, conditions, {
+    --     tarantool_iter = opts.tarantool_iter,
+    --     scan_condition_num = opts.scan_condition_num,
+    -- })
+    -- if err ~= nil then
+    --     return nil, SelectError:new("Failed to generate tuples filter: %s", err)
+    -- end
+
+    -- -- execute select
+    -- local resp, err = select_executor.execute(space, index, filter_func, {
+    --     scan_value = opts.scan_value,
+    --     after_tuple = opts.after_tuple,
+    --     tarantool_iter = opts.tarantool_iter,
+    --     limit = opts.limit,
+    -- })
+    -- if err ~= nil then
+    --     return nil, SelectError:new("Failed to execute select: %s", err)
+    -- end
+
+    -- local cursor
+    -- if resp.tuples_fetched < opts.limit or opts.limit == 0 then
+    --     cursor = {is_end = true}
+    -- else
+    --     cursor = make_cursor(resp.tuples)
+    -- end
+
+    -- cursor.stats = {
+    --     tuples_lookup = resp.tuples_lookup,
+    --     tuples_fetched = resp.tuples_fetched,
+    -- }
+
+    -- -- getting tuples with user defined fields (if `fields` option is specified)
+    -- -- and fields that are needed for comparison on router (primary key + scan key)
+    -- return cursor, schema.filter_tuples_fields(resp.tuples, opts.field_names)
 end
 
 function select_module.init()

The issue wasn't introduced in #244, since it would fail with similar error if we checkout to 263900b

{
   "class_name":"SelectError",
   "err":"...Development\/github\/tarantool\/crud\/crud\/select\/merger.lua:113: 'void *' has no member named 'is_end'",
   "stack":"stack traceback:\n\t...ment\/github\/tarantool\/crud\/crud\/select\/compat\/select.lua:279: in function <...ment\/github\/tarantool\/crud\/crud\/select\/compat\/select.lua:230>\n\t[C]: in function 'xpcall'\n\t...\/github\/tarantool\/crud\/.rocks\/share\/tarantool\/errors.lua:145: in function <...\/github\/tarantool\/crud\/.rocks\/share\/tarantool\/errors.lua:139>\n\t[C]: at 0x5651d7718c50\nduring wrapped call\nstack traceback:\n\t...b\/tarantool\/crud\/\/\/test\/performance\/select_perf_test.lua:91: in function <...b\/tarantool\/crud\/\/\/test\/performance\/select_perf_test.lua:87>\n\t[C]: in function 'pcall'\n\t...b\/tarantool\/crud\/\/\/test\/performance\/select_perf_test.lua:87: in function <...b\/tarantool\/crud\/\/\/test\/performance\/select_perf_test.lua:85>",
   "str":"SelectError: ...Development\/github\/tarantool\/crud\/crud\/select\/merger.lua:113: 'void *' has no member named 'is_end'"
}

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions