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

Add destination cluster info to response cookie #466

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

harishnelakurthi
Copy link

@harishnelakurthi harishnelakurthi commented Sep 10, 2024

Description

Add destination cluster a query is routed to in the cookie. More details here of the use-case here: #465

Additional context and related issues

#465

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

* The cookie data for requests to `/v1/statement` API would include the cluster to which a query got routed named as `trinoClusterHost`.

Copy link

cla-bot bot commented Sep 10, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link

cla-bot bot commented Sep 11, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link

cla-bot bot commented Sep 11, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@willmostly
Copy link
Contributor

I think a Cookie would be more appropriate than adding a new header. Typically headers implement the protocol, and cookies are used for storing session information and passing data back and forth

Copy link

cla-bot bot commented Sep 12, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@willmostly
Copy link
Contributor

@harishnelakurthi please sign the CLA so that we can take this forward, and address all comments. Please squash your commits as well.

@harishnelakurthi
Copy link
Author

@willmostly - I have signed the CLA and emailed a week ago. Also, I've addressed all the comments on the PR except there was an open question which I have responded to the reviewer. Let me know if anything is needed from my end.

@willmostly
Copy link
Contributor

@harishnelakurthi I think you may have missed my comment above. I would like to avoid adding a new header just to pass back information unrelated to the routing protocol. This should be a cookie. You can also update the logic such that the cookie is only added/updated in the response to a POST to v1/statement. Please update the PR title and description to reflect the change as well.

Copy link

cla-bot bot commented Sep 18, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@harishnelakurthi harishnelakurthi changed the title Add destination backend host to response headers for a query Add destination backend host to response cookie Sep 18, 2024
@harishnelakurthi
Copy link
Author

Thanks, @willmostly I have made the changes to pass this data via session cookie. Please review and let me know if any changes are needed. Also, updated the PR title and description. Will squash the commits before merge.

@andythsu
Copy link
Member

andythsu commented Sep 19, 2024

Can we change the PR name and commit title to "cluster" instead of "backend"

@harishnelakurthi harishnelakurthi changed the title Add destination backend host to response cookie Add destination cluster info to response cookie Sep 19, 2024
@cla-bot cla-bot bot added the cla-signed label Sep 19, 2024
@willmostly
Copy link
Contributor

@harishnelakurthi you can use Airlift's codestyle in your IDE to avoid builds failing due to checkstyle https://github.com/airlift/codestyle

Copy link
Contributor

@willmostly willmostly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty close % comments.

Can you add a test for this functionality? TestGatewayHaMultipleBackend should have the infrastructure you need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants