-
Notifications
You must be signed in to change notification settings - Fork 86
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
Conversation
...e-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookieInterceptor.java
Outdated
Show resolved
Hide resolved
...le-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookieHolderTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookieInterceptor.java
Outdated
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Outdated
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Outdated
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Outdated
Show resolved
Hide resolved
...ble/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...loud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesUnaryCallable.java
Outdated
Show resolved
Hide resolved
...loud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesUnaryCallable.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
Outdated
Show resolved
Hide resolved
...le-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookieHolderTest.java
Outdated
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Outdated
Show resolved
Hide resolved
...-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesInterceptor.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolder.java
Outdated
Show resolved
Hide resolved
...-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/CookiesInterceptor.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
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"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 :(
There was a problem hiding this comment.
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
Warning: This pull request is touching the following templated files:
|
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
🤖 I have created a release *beep* *boop* --- ## [2.30.0](https://togithub.com/googleapis/java-bigtable/compare/v2.29.1...v2.30.0) (2023-12-05) ### Features * Client sends routing cookie back to server ([#1888](https://togithub.com/googleapis/java-bigtable/issues/1888)) ([4c73abd](https://togithub.com/googleapis/java-bigtable/commit/4c73abd2f4a07808b591dd9178e87715d2f3008d)) ### Dependencies * Update dependency org.junit.vintage:junit-vintage-engine to v5.10.1 ([#1990](https://togithub.com/googleapis/java-bigtable/issues/1990)) ([7ad70e3](https://togithub.com/googleapis/java-bigtable/commit/7ad70e3abc1af7dfab715386978bf14f02b34e5d)) * Update shared dependencies ([#2016](https://togithub.com/googleapis/java-bigtable/issues/2016)) ([4e49dff](https://togithub.com/googleapis/java-bigtable/commit/4e49dffa72db8dd04e75ca86178d875fab6f566b)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
import javax.annotation.Nullable; | ||
|
||
/** A cookie that holds information for retry or routing */ | ||
class CookiesHolder { |
There was a problem hiding this comment.
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
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:
Fixes #<issue_number_goes_here> ☕️
If you write sample code, please follow the samples format.