Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong marshalling for call17 & eval responses + add support for unknown request types and response body keys #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Speshal71
Copy link

@Speshal71 Speshal71 commented Dec 26, 2024

The problem

Hi! We use your library for our tarantool proxy and have encountered few flaws:

  1. The result array of bytes of *Result marshalling might be different from original sequence of bytes it was umarshalled from. It's a case at least for call17 and eval responses.
    The documentation specifies response as a list of values:
    https://www.tarantool.io/en/doc/2.11/dev_guide/internals/iproto/requests/#iproto-call
    Instead the library forcefully wraps it to be a list of tuples of values:
    r.Data[i] = []interface{}{val}

    Additionally it skips unknown keys encountered in the body which might be critical for currently unsupported types of responses like IPROTO_ID:
    if buf, err = msgp.Skip(buf); err != nil {
  2. Provided iproto server treats currently unsupported types of requests (like mentioned above IPROTO_ID) to be responses:

    go-tarantool/packet.go

    Lines 117 to 120 in 6f8008d

    if q := NewQuery(pack.Cmd); q != nil {
    return unpackq(q, data)
    }
    return unpackr(OKCommand, data)

The solution

  1. Provide *Result option to save and then marshal original sequence of bytes
  2. Provide IprotoServer option to treat all requests including unknown ones as actually requests

@Speshal71 Speshal71 changed the title Fix wrong unmarshalling for call17 & eval responses + add support for unknown request types and response body keys Fix wrong marshalling for call17 & eval responses + add support for unknown request types and response body keys Dec 26, 2024
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.

2 participants