-
Notifications
You must be signed in to change notification settings - Fork 88
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: extend channel priming logic to also send fake requests #398
Conversation
Codecov Report
@@ Coverage Diff @@
## master #398 +/- ##
============================================
+ Coverage 80.24% 80.36% +0.11%
- Complexity 1102 1113 +11
============================================
Files 105 105
Lines 6815 6897 +82
Branches 364 369 +5
============================================
+ Hits 5469 5543 +74
- Misses 1148 1155 +7
- Partials 198 199 +1
Continue to review full report at Codecov.
|
throws IOException { | ||
EnhancedBigtableStubSettings.Builder builder = settings.toBuilder(); | ||
|
||
if (settings.isRefreshingChannel()) { |
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.
Can we add some tests around this to ensure the proper values are set in the settings?
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 added a test for testChannelPrimerConfigured, which should cover the behavior of it
@@ -760,17 +787,10 @@ public EnhancedBigtableStubSettings build() { | |||
Preconditions.checkState(projectId != null, "Project id must be set"); | |||
Preconditions.checkState(instanceId != null, "Instance id must be set"); | |||
|
|||
// Set ChannelPrimer on TransportChannelProvider so channels will gracefully refresh | |||
// connections to Cloud Bigtable service | |||
if (isRefreshingChannel) { | |||
Preconditions.checkArgument( | |||
getTransportChannelProvider() instanceof InstantiatingGrpcChannelProvider, |
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.
should this check be moved to where we are setting the transport provider, https://github.com/googleapis/java-bigtable/pull/398/files#diff-dad9668e639c962562540f7f70a24138R144?
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.
No, I want the validation logic to be as close to usage as possible.
...bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableChannelPrimerTest.java
Show resolved
Hide resolved
...loud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java
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.
Channel priming logic looks good!
I'm not the most familiar with the stub and stub settings. A second opinion on that would be useful.
...oud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableChannelPrimer.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
private void primeChannelUnsafe(ManagedChannel managedChannel) throws IOException { |
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'm not sure I understand why this is called unsafe?
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.
Because it could throw an exception, does the priming api expect to handle the exceptions?
...loud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java
Show resolved
Hide resolved
builder.setTransportChannelProvider( | ||
transportProvider | ||
.toBuilder() | ||
.setChannelPrimer( |
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.
It would be nice to have a comment here explaining the consequence of "setChannelPrimer" that the channel is created once, but periodically creates a new channel, runs BigtableChannelPrimer on the newly created channel and replaces the existing one with the new one.
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 dont quite follow, can you rephrase?
...oud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableChannelPrimer.java
Show resolved
Hide resolved
🤖 I have created a release \*beep\* \*boop\* --- ## [1.15.0](https://www.github.com/googleapis/java-bigtable/compare/v1.14.0...v1.15.0) (2020-09-01) ### Features * extend channel priming logic to also send fake requests ([#398](https://www.github.com/googleapis/java-bigtable/issues/398)) ([6f1ead2](https://www.github.com/googleapis/java-bigtable/commit/6f1ead2097150a87cb9712bcf35c6eaa9d57440c)) * **deps:** adopt flatten plugin and google-cloud-shared-dependencies ([#350](https://www.github.com/googleapis/java-bigtable/issues/350)) ([2298596](https://www.github.com/googleapis/java-bigtable/commit/2298596dab8a1ef87c0f48d3abe8bc3955417eb1)) ### Bug Fixes * temporarily disable reporting to unblock releases ([#395](https://www.github.com/googleapis/java-bigtable/issues/395)) ([a56a0f8](https://www.github.com/googleapis/java-bigtable/commit/a56a0f8c9caf675b68d02587b042e1feeb261ccb)) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.6 ([#377](https://www.github.com/googleapis/java-bigtable/issues/377)) ([bdae336](https://www.github.com/googleapis/java-bigtable/commit/bdae336074d80815dcaaf8c71befafc0ed66c079)) * update dependency com.google.cloud:google-cloud-shared-dependencies to v0.9.0 ([#402](https://www.github.com/googleapis/java-bigtable/issues/402)) ([08f7d84](https://www.github.com/googleapis/java-bigtable/commit/08f7d84333c6a74bf03e0a57707b878a29400dd4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
This PR upgrades the existing channel refresher to send a fake read row request to ensure that server side caches are warmed up. The new refresher will create a temporary stub around the new channel, which will reuse all of the existing request decorations (resource headers and user agent)