Skip to content

router: fix return_raw with is_async and in retries - #683

Open
d-enk wants to merge 2 commits into
tarantool:masterfrom
d-enk:fix-return-raw-retry
Open

d-enk wants to merge 2 commits into
tarantool:masterfrom
d-enk:fix-return-raw-retry

Conversation

@d-enk

@d-enk d-enk commented Nov 24, 2026

Copy link
Copy Markdown

Why

return_raw is broken in two ways.

With is_async it does nothing: the future wrapper decodes the values, so the
user gets a table instead of a msgpack object.

The retry is also broken. The storage's error comes packed, lerror.make()
cannot decode msgpack, so err.code is lost and the router returns the error
instead of rerouting the request to the new bucket location.

What

Cut the status flag in the future wrapper too, and unpack the error for
lerror.make(). The rest of the response stays packed.

The synchronous call now returns an empty object for an empty response instead
of nil, so both paths match netbox.

Two commits: the retry fix first, then the shared helper plus the async path.
The reverse order is impossible — the helper alone already fixes the retry.

Validation

test_return_raw_async, test_return_raw_nil_status, and
test_retryable_transfer_in_progress_raw in
test/router-luatest/router_2_2_test.lua.

All 29 tests of the file pass.

Closes #592
Closes #682

'return_raw' gives the storage's response to the router packed.
Its first element is a flag whether the call succeeded. The error comes
packed too. lerror.make() can't decode msgpack, so the error lost
its code, and the router could not see that it was retriable. The failed
request was returned to the user instead of being rerouted to the new
bucket location.

Unpack the error, but keep the rest of the response packed.

A nil flag is packed as null and comes back as box.NULL,
which is truthy. Treat it as a failure too, otherwise the error
was returned as a regular value.

Closes tarantool#682

NO_DOC=bugfix
The synchronous call cut the storage's status flag out of the raw
response, but the asynchronous one did not. It went through the usual
branch, which decodes the values, so 'return_raw' had no effect
with 'is_async'.

Cut the flag in the future wrapper as well, and return the rest as is,
the same way as the synchronous call and netbox do.

Now the synchronous call also returns an empty object for an empty
response instead of nil, to keep both paths identical and to match
netbox.

Closes tarantool#592

NO_DOC=bugfix
@Serpentian
Serpentian self-requested a review November 30, 2026 10:40
@Serpentian Serpentian self-assigned this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

return_raw breaks router retry on retriable storage errors return_raw=true option doesn't work with is_async=true router.call

2 participants