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 18, 2023
1 parent b3c27b3 commit f6d7f61
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vshard/storage/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,16 @@ end
-- exceptions are not allowed.
--
local function local_call(func_name, args)
return pcall(netbox_self_call, netbox_self, func_name, args)
-- box.func was introduced only in Tarantool 2.2. net_box.self.call
-- doesn't work with C stored procedures up to Tarantool 3.0.0-alpha3.
-- If function wasn't created with box.schema.func interface, then it's
-- not in box.func and we should still use net_box.self.call.
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 f6d7f61

Please sign in to comment.