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

feat: handle the X-Databend-Route-Hint header returned from the server side #280

Closed
flaneur2020 opened this issue Sep 29, 2024 · 5 comments
Assignees

Comments

@flaneur2020
Copy link
Member

flaneur2020 commented Sep 29, 2024

on some cases, the server will response a X-Databend-Route-Hint header in the response.

when server responded this header, the client should forget its own generated rout-hint, and remember the route-hint returned from the server.

this header is useful to keep the client session sticky on the same cluster when there're multiple clusters in the server side.

it seems that the jdbc driver still haven't processed this header from the server response yet.

may reference the logic in the go driver: https://github.com/databendlabs/databend-go/blob/main/client.go#L500

@hantmac
Copy link
Member

hantmac commented Sep 29, 2024

Hi @flaneur2020 , the jdbc has handle the logic as same as go driver, maybe you can check here: https://github.com/databendlabs/databend-jdbc/blob/main/databend-client/src/main/java/com/databend/client/DatabendClientV1.java#L312

@hantmac hantmac self-assigned this Sep 29, 2024
@TCeason
Copy link

TCeason commented Sep 29, 2024

If so maybe we can delete this?

https://github.com/datafuselabs/databend-jdbc/blob/bab24f4cc34b741513497620f041ae1b9b2c3e44/databend-jdbc/src/main/java/com/databend/jdbc/ConnectionProperties.java#L254

private static class RouteHint
            extends AbstractConnectionProperty<String> {
        public RouteHint() {
            super("route_hint", NOT_REQUIRED, ALLOWED, STRING_CONVERTER);
        }
    }

It's no usage.

@flaneur2020
Copy link
Member Author

If so maybe we can delete this?

https://github.com/datafuselabs/databend-jdbc/blob/bab24f4cc34b741513497620f041ae1b9b2c3e44/databend-jdbc/src/main/java/com/databend/jdbc/ConnectionProperties.java#L254

private static class RouteHint
            extends AbstractConnectionProperty<String> {
        public RouteHint() {
            super("route_hint", NOT_REQUIRED, ALLOWED, STRING_CONVERTER);
        }
    }

It's no usage.

if the code is not being referenced, i guess it's good to clean it up 🤔

@flaneur2020
Copy link
Member Author

Hi @flaneur2020 , the jdbc has handle the logic as same as go driver, maybe you can check here: https://github.com/databendlabs/databend-jdbc/blob/main/databend-client/src/main/java/com/databend/client/DatabendClientV1.java#L312

thank you for clarifying this, i believe the behaviour is aligned with the go-driver.

here the implmenetation stores the it in additionalHeaders, while the go-driver stores it inside a field of the client struct. the final behaviour should be the same.

@hantmac
Copy link
Member

hantmac commented Sep 30, 2024

@TCeason #281 this pr clean up it, I will close this issue.

@hantmac hantmac closed this as completed Sep 30, 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

No branches or pull requests

3 participants