Skip to content

Commit

Permalink
storage: fix local_call not finding C stored procedures
Browse files Browse the repository at this point in the history
Currently, if function was created as C stored procedure with
box.schema.func.create, all types of router.call and router.map_callrw
cannot find it and return `Procedure 'name' is not defined` error.
This is cased by the fact that both of these function use local_call,
which invokes net_box.self.call, which doesn't currently work with
C stored procedures due to the bug.

Let's use box.func, where it's possible instead of net_box.self.call
in local_call.

Closes #436

NO_DOC=bugfix
NO_TEST=<already tested>
  • Loading branch information
Serpentian committed Sep 25, 2023
1 parent b3c27b3 commit 7896de9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vshard/storage/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,17 @@ end
-- exceptions are not allowed.
--
local function local_call(func_name, args)
return pcall(netbox_self_call, netbox_self, func_name, args)
-- If function was created with box.schema.func we call it via
-- func.call API, as net_box.self.call doesn't work with C stored
-- procedures up to Tarantool 3.0. If box.func is inaccessible,
-- which is true for all versions below 2.2, we fallback to
-- net_box.self.call too.
if box.func == nil or box.func[func_name] == nil then
return pcall(netbox_self_call, netbox_self, func_name, args)
end

local func = box.func[func_name]
return pcall(func.call, func, args)
end

--
Expand Down

0 comments on commit 7896de9

Please sign in to comment.