Skip to content

map_callrw can't find c stored procedure #436

Closed

Description

Problem

We have a c stored procedure execute, earlier we called it via replicaset api like this:

replica:callbre(
                'execute',
                args,
                { is_async = true }
)

Now we've started to use map_callrw router api, which gives us an error saying it is not defined:

router.map_callrw('execute', args)

---
- null
- code: 33
  base_type: ClientError
  type: ClientError
  message: Procedure 'execute' is not defined
  trace: [{'file': './src/box/lua/call.c', 'line': 112}]
- 5bb12a3c-4de8-4059-8172-8c926d6a6bc2
...

The function was created like this:

box.schema.func.create(
            'execute',
            { if_not_exists = true, language = 'C' }
        )

And it is callable through box.func api:

box.func['execute']:call()
---
- error: 'Failed to decode dispatched data: Invalid(Tuple, Some("expected
    tuple of 2 elements, got 0"))'
...

Tarantool version: 2.11.0
Vshard version: latest

Hint

After digging a bit in the code I found that map_callrw(f, args) calls storage_map(f, args), the latter calls net.box.self.call(f, args) and this internally in tarantool calls box_lua_find which tries to find the function in lua globals.

On the other hand, replica:callbre(f, args) calls net.box.conn.call, the latter first checks whether the function is in cache and only then uses box_lua_find.

So the problem seems to be in using self.call inside storage_map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't workingstorage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions