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: client sends routing cookie back to server #1888

Merged
merged 23 commits into from Nov 27, 2023

Conversation

mutianf
Copy link
Contributor

@mutianf mutianf commented Aug 16, 2023

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/java-bigtable API. labels Aug 16, 2023
@mutianf mutianf changed the title feat: [POC] client sends retry cookie back to server feat: client sends retry cookie back to server Oct 18, 2023
@mutianf mutianf marked this pull request as ready for review October 24, 2023 14:15
@mutianf mutianf requested a review from a team as a code owner October 24, 2023 14:15
@mutianf mutianf changed the title feat: client sends retry cookie back to server feat: client sends routing cookie back to server Nov 14, 2023
String bytes1 = serverMetadata.get(1).get(ROUTING_COOKIE_1);
String bytes2 = serverMetadata.get(1).get(ROUTING_COOKIE_2);
assertThat(bytes1).isNotNull();
assertThat(bytes1).isEqualTo("readRows");
Copy link
Contributor

Choose a reason for hiding this comment

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

assertThat(bytes1).isEqualTo("readRows"); should cover isNotNull

Copy link
Contributor

Choose a reason for hiding this comment

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

why get(1)? is that the last one? if so please make it explicit

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally you would add a MetadataSubject and then did something like this:

assertThat(serverMetadata).isNotEmpty();
Metadata lastMd = serverMetadata.get(serverMetadata.size() - 1);

assertThat(serverMetadata.get(lastMd).containsAtLeast(ROUTING_COOKIE_1, "readRows", ROUTING_COOKIE_2, testCookieValue);
assertThat(serverMetadata.get(lastMd).doesNotContainKey(BAD_KEY)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think I can do assertThat(serverMetadata.get(lastMd).containsAtLeast(ROUTING_COOKIE_1, "readRows", ROUTING_COOKIE_2, testCookieValue); because metadata is not a map :( and I can't get the map out of it :(

Copy link
Contributor

Choose a reason for hiding this comment

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

with a custom subject you can

@mutianf mutianf requested a review from a team as a code owner November 22, 2023 18:16
Copy link

Warning: This pull request is touching the following templated files:

  • .kokoro/build.sh

Copy link
Contributor

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

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

lgtm after the last set of comments

@mutianf mutianf added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 22, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 22, 2023
@mutianf mutianf added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 22, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 22, 2023
import javax.annotation.Nullable;

/** A cookie that holds information for retry or routing */
class CookiesHolder {
Copy link
Member

Choose a reason for hiding this comment

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

I would have called this a CookieJar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/java-bigtable API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants