dgraph-io / ratel

Dgraph Data Visualizer and Cluster Manager
Apache License 2.0
120 stars 49 forks source link

[BUG]: moveTablet endpoint doesn't work. #291

Closed MichelDiz closed 1 month ago

MichelDiz commented 1 year ago

What version of Dgraph are you using?

v22.0.1

Tell us a little more about your go-environment?

N/A

Have you tried reproducing the issue with the latest release?

No response

What is the hardware spec (RAM, CPU, OS)?

N/A

What steps will reproduce the bug?

http://localhost:6080/moveTablet?tablet=%00%00%00%00%00%00%00%00HAS&group=2

response:

{"errors":[{"message":"namespace: 0. No tablet found for: \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000HAS","extensions":{"code":"ErrorInvalidRequest"}}]}
{"errors":[{"message":"namespace: 0. No tablet found for: \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000REGISTERS","extensions":{"code":"ErrorInvalidRequest"}}]}
curl "http://localhost:6080/moveTablet?tablet=%00%00%00%00%00%00%00%00REGISTERS&group=2"
{"errors":[{"message":"namespace: 0. No tablet found for: \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000REGISTERS","extensions":{"code":"ErrorInvalidRequest"}}]}

Expected behavior and actual result.

"message": "namespace: 0. Predicate: [HAS] moved from group [3] to [4]"

It is related to https://github.com/dgraph-io/dgraph/issues/8389

Additional information

It is possible to move via GraphQL

mutation moveTB {
    moveTablet(input: {namespace:0, tablet:"HAS", groupId: 4}){
        response {
            code
            message
        }
    }
}
{
    "data": {
        "moveTablet": {
            "response": {
                "code": "Success",
                "message": "namespace: 0. Predicate: [HAS] moved from group [3] to [4]"
            }
        }
    },
    "extensions": {
        "tracing": {
            "version": 1,
            "startTime": "2022-11-26T23:47:17.552849165Z",
            "endTime": "2022-11-26T23:47:18.380343262Z",
            "duration": 827494097
        }
    }
}

And if you remove the binary prefix it works again

http://localhost:6080/moveTablet?tablet=name&group=2
matthewmcneely commented 1 year ago

I think this bug should be in the dgraph repo, but in the meantime...

Tablet names are encoded along with their namespace in storage. See here. I think the "fix" would be to ensure that wherever tablet names are presented to users, i.e., https://github.com/dgraph-io/dgraph/issues/8389, that they are converted properly as strings.

MichelDiz commented 1 year ago

I think if we solve 8389 + 8451 and make sure all logs and responses are formated well. This issue with Ratel will fix by itself.

We could fix it in Ratel. Via some function. But it is preferable that it is in Dgraph's Core Code. I just don't know which one will take longer. So leave this issue here, as it is in theory a duplicate of 8389 + 8451. Right? Leave it here so that users can see that the problem exists and the reasons.

matthewmcneely commented 1 year ago

as it is in theory a duplicate of 8389 + 8451. Right?

Agreed

github-actions[bot] commented 2 months ago

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.