Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
aa4111ad
Verified
Commit
aa4111ad
authored
1 year ago
by
Georgy Moshkin
Committed by
Denis Smirnov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: support for compat.c_func_iproto_multireturn = 'new'
parent
2ba636c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1414
sbroad import
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sbroad-core/src/core-router.lua
+10
-5
10 additions, 5 deletions
sbroad-core/src/core-router.lua
sbroad-core/src/helper.lua
+25
-0
25 additions, 0 deletions
sbroad-core/src/helper.lua
with
35 additions
and
5 deletions
sbroad-core/src/core-router.lua
+
10
−
5
View file @
aa4111ad
...
...
@@ -247,7 +247,8 @@ _G.dql_on_some = function(uuid_to_args, is_readonly, waiting_timeout, vtable_max
if
err
~=
nil
then
error
(
err
)
end
result
=
res
[
1
][
1
][
1
]
-- TODO: explain where this `[1][1]` comes from
result
=
helper
.
unwrap_execute_result
(
res
[
1
][
1
])
else
local
err
,
err_uuid
local
opts
=
{
map_timeout
=
waiting_timeout
,
ref_timeout
=
waiting_timeout
}
...
...
@@ -320,10 +321,12 @@ _G.dml_on_some = function(tbl_rs_ir, is_readonly, waiting_timeout)
error
(
err
)
end
-- TODO: explain where this `[1][1]` comes from
local
next_result
=
helper
.
unwrap_execute_result
(
res
[
1
][
1
])
if
result
==
nil
then
result
=
res
[
1
][
1
][
1
]
result
=
next_result
else
result
.
row_count
=
result
.
row_count
+
res
[
1
][
1
][
1
]
.
row_count
result
.
row_count
=
result
.
row_count
+
next_result
.
row_count
end
end
...
...
@@ -369,10 +372,12 @@ _G.dml_on_all = function(required, optional, is_readonly, waiting_timeout)
error
(
err
)
end
-- TODO: explain where this `[1][1]` comes from
local
next_result
=
helper
.
unwrap_execute_result
(
res
[
1
][
1
])
if
result
==
nil
then
result
=
res
[
1
][
1
][
1
]
result
=
next_result
else
result
.
row_count
=
result
.
row_count
+
res
[
1
][
1
][
1
]
.
row_count
result
.
row_count
=
result
.
row_count
+
next_result
.
row_count
end
end
...
...
This diff is collapsed.
Click to expand it.
sbroad-core/src/helper.lua
+
25
−
0
View file @
aa4111ad
local
compat
=
require
(
'compat'
)
local
compat_mt
=
compat
~=
nil
and
getmetatable
(
compat
)
or
nil
-- Make table read-only
local
function
protect
(
tbl
)
return
setmetatable
({},
{
...
...
@@ -64,10 +67,32 @@ local function dql_error(err, rs_uuid)
error
(
err
)
end
local
function
unwrap_execute_result
(
result
)
if
compat_mt
==
nil
then
return
result
[
1
]
end
-- We want to just call `compat.c_func_iproto_multireturn:is_new()`,
-- but it throws an exception when the option is unknown.
local
ok
,
opt
=
pcall
(
compat_mt
.
__index
,
compat
,
'c_func_iproto_multireturn'
)
if
ok
and
opt
:
is_new
()
then
-- On older versions of tarantool there was a bug which made all FFI
-- stored procedures' wrap their return values into an additional
-- msgpack array (they call it "multireturn", but you couldn't put
-- multiple values in there, it was hard-coded to be 1 element). But
-- thankfully it was fixed and now we get to rewrite all of our code...
-- Yay!
-- See https://github.com/tarantool/tarantool/issues/4799
return
result
else
return
result
[
1
]
end
end
return
{
module_name
=
module_name
,
vtable_limit_exceeded
=
vtable_limit_exceeded
,
dql_error
=
dql_error
,
format_result
=
format_result
,
unwrap_execute_result
=
unwrap_execute_result
,
constants
=
constants
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment