Skip to content

Commit 261ed95

Browse files
fix: update local vRPC status to match the last session failure when a Session couldn't be established (#2888)
This should bubble up PERMISSION_DENIED as the vRPC status instead of hardcoding UNAVAILABLE and forcing end users to read the message to see why the session failed Change-Id: Ic7336b26713199085406d267b5918f8fd9186b8e 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](https://togithub.com/googleapis/java-bigtable/issues/new/choose) 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) - [ ] Rollback plan is reviewed and LGTMed - [ ] All new data plane features have a completed end to end testing plan Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent 0a2bf6c commit 261ed95

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,12 @@ private void onSessionClose(
507507
// vRPCs failing with consecutive failures should fail
508508
VRpcResult result =
509509
VRpcResult.createRejectedError(
510-
Status.UNAVAILABLE.withDescription(
511-
String.format(
512-
"Session failed with consecutive failures. Most recent server status: %s,"
513-
+ " metadata: %s.",
514-
status, trailers)));
510+
Status.fromCode(status.getCode())
511+
.withDescription(
512+
String.format(
513+
"Session failed with consecutive failures. Most recent server status: %s,"
514+
+ " metadata: %s.",
515+
status, trailers)));
515516
for (PendingVRpc<?, ?> vrpc : toBeClosed) {
516517
try {
517518
vrpc.getListener().onClose(result);

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void consecutiveFailuresTest() {
206206
assertThat(exception)
207207
.hasMessageThat()
208208
.contains(
209-
"UNAVAILABLE: Session failed with consecutive failures. Most recent server status:"
209+
"INTERNAL: Session failed with consecutive failures. Most recent server status:"
210210
+ " Status{code=INTERNAL, description=fake internal error. PeerInfo:"
211211
+ " transport_type: TRANSPORT_TYPE_SESSION_UNKNOWN, cause=null}");
212212
}

0 commit comments

Comments
 (0)