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

feature: remove TripleRpcException #8712

Merged
merged 8 commits into from
Sep 8, 2021

Conversation

x-shadow-man
Copy link

What is the purpose of the change

Remove and support dubbo status to triple status mapping for issue #8659

Brief changelog

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@guohao
Copy link
Contributor

guohao commented Sep 7, 2021

Plz fix code format

@x-shadow-man
Copy link
Author

Plz fix code format

done. pls feel free to review, thx

@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2021

Codecov Report

Merging #8712 (22f194a) into 3.0 (bdd253f) will increase coverage by 0.04%.
The diff coverage is 10.71%.

❗ Current head 22f194a differs from pull request most recent head e0f2871. Consider uploading reports for the commit e0f2871 to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##                3.0    #8712      +/-   ##
============================================
+ Coverage     63.69%   63.73%   +0.04%     
- Complexity      313      314       +1     
============================================
  Files          1146     1145       -1     
  Lines         48145    48160      +15     
  Branches       7252     7250       -2     
============================================
+ Hits          30668    30697      +29     
+ Misses        14111    14103       -8     
+ Partials       3366     3360       -6     
Impacted Files Coverage Δ
...c/main/java/org/apache/dubbo/rpc/RpcException.java 83.33% <ø> (ø)
...rg/apache/dubbo/rpc/protocol/tri/ClientStream.java 80.00% <0.00%> (ø)
.../org/apache/dubbo/rpc/protocol/tri/GrpcStatus.java 41.66% <0.00%> (-3.21%) ⬇️
...ache/dubbo/rpc/protocol/tri/UnaryClientStream.java 29.62% <0.00%> (ø)
.../dubbo/rpc/protocol/tri/service/TriHealthImpl.java 33.33% <0.00%> (+0.52%) ⬆️
...ache/dubbo/rpc/protocol/tri/UnaryServerStream.java 47.22% <13.33%> (-4.30%) ⬇️
...pc/protocol/tri/TripleHttp2FrameServerHandler.java 40.90% <21.05%> (ø)
...ava/org/apache/dubbo/registry/AddressListener.java 0.00% <0.00%> (-100.00%) ⬇️
...he/dubbo/rpc/cluster/router/state/RouterCache.java 66.66% <0.00%> (-11.12%) ⬇️
...n/java/org/apache/dubbo/common/bytecode/Proxy.java 66.43% <0.00%> (-4.80%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdd253f...e0f2871. Read the comment docs.

code = Code.ABORTED;
break;
case TIMEOUT_TERMINATE:
code = Code.OUT_OF_RANGE;
Copy link
Contributor

Choose a reason for hiding this comment

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

DEADLINE_EXCEEDED

code = Code.PERMISSION_DENIED;
break;
case LIMIT_EXCEEDED_EXCEPTION:
code = Code.ABORTED;
Copy link
Contributor

Choose a reason for hiding this comment

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

}
return fromCode(code);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Add NETWORK_EXCEPTION -> UNAVAILABLE
SERIALIZATION_EXCEPTION -> INTERNAL

if (exception instanceof TripleRpcException) {
transportError(((TripleRpcException) exception).getStatus(), response.getObjectAttachments());
if (exception instanceof RpcException) {
transportError(rpcExceptionCodeToGrpc(((RpcException) exception).getCode()), response.getObjectAttachments());
Copy link
Contributor

Choose a reason for hiding this comment

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

detail msg in RPCException has been dropped, should be pass to Status' description

if (e instanceof TripleRpcException) {
transportError(((TripleRpcException) e).getStatus(), response.getObjectAttachments());
if (e instanceof RpcException) {
transportError(rpcExceptionCodeToGrpc(((RpcException) e).getCode()), response.getObjectAttachments());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue as above

@EarthChen
Copy link
Member

image

@@ -82,6 +83,28 @@ public static byte toDubboStatus(Code code) {
return status;
}

public static GrpcStatus rpcExceptionCodeToGrpc(int rpcExceptionCode) {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to replace it with enum?and put them in map and getValue

Copy link
Member

@EarthChen EarthChen left a comment

Choose a reason for hiding this comment

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

LGTM

@guohao guohao merged commit 3aa7168 into apache:3.0 Sep 8, 2021
@wxbty wxbty deleted the feat/remove-triple-rpc-exception branch March 18, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants