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

modify triple unique id logic #1006

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Conversation

hui-cha
Copy link
Collaborator

@hui-cha hui-cha commented Dec 28, 2020

Motivation:

根据讨论,triple 协议的 unique id 需要通过请求头传递,RPC 框架根据请求头中的 uniquid id 路由到对应的业务服务,调用其实现。原有的将 unique id 拼接到请求 path 中的做法需要回退掉。

Modification:

针对 triple 请求作出如下修改

  1. 移除掉将 unique id 拼接到 path 中的逻辑
  2. 增加 UniuqeIdInvoker 用于管理服务端发布的服务
  3. 服务端收到请求时从请求头中获取到 unique id 放入 RPC 上下文中

@sofastack-bot
Copy link

sofastack-bot bot commented Dec 28, 2020

Hi @hui-cha, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

@sofastack-bot sofastack-bot bot added cla:no Need sign CLA First-time contributor First-time contributor size/L labels Dec 28, 2020
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from 950cc39 to d417e62 Compare February 25, 2021 10:02
@hui-cha hui-cha closed this Apr 28, 2021
@OrezzerO OrezzerO reopened this May 11, 2021
@EvenLjj EvenLjj requested a review from OrezzerO May 12, 2021 09:16
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from d417e62 to a25c78b Compare May 13, 2021 13:26
@sofastack-bot sofastack-bot bot added cla:yes CLA is ok and removed cla:no Need sign CLA labels May 13, 2021
@EvenLjj EvenLjj added this to the 5.8.3 milestone Jan 10, 2022
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch 6 times, most recently from 3e55d20 to 7bd2796 Compare January 20, 2022 06:50
@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #1006 (77cc488) into master (956a546) will increase coverage by 0.02%.
The diff coverage is 73.17%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1006      +/-   ##
============================================
+ Coverage     71.06%   71.08%   +0.02%     
+ Complexity      828      826       -2     
============================================
  Files           406      407       +1     
  Lines         17150    17180      +30     
  Branches       2671     2679       +8     
============================================
+ Hits          12187    12213      +26     
  Misses         3591     3591              
- Partials       1372     1376       +4     
Impacted Files Coverage Δ
.../rpc/bootstrap/triple/TripleProviderBootstrap.java 100.00% <ø> (+8.33%) ⬆️
...a/com/alipay/sofa/rpc/constant/TripleConstant.java 75.00% <ø> (ø)
.../alipay/sofa/rpc/server/triple/TripleContants.java 0.00% <ø> (ø)
...java/com/alipay/sofa/rpc/utils/SofaProtoUtils.java 93.75% <ø> (+3.27%) ⬆️
...om/alipay/sofa/rpc/server/triple/TripleServer.java 74.03% <67.56%> (-7.15%) ⬇️
...alipay/sofa/rpc/server/triple/UniqueIdInvoker.java 75.60% <75.60%> (ø)
...ofa/rpc/tracer/sofatracer/TripleTracerAdapter.java 60.44% <100.00%> (+0.90%) ⬆️
...sofa/rpc/transport/triple/TripleClientInvoker.java 87.67% <100.00%> (+0.82%) ⬆️
... and 4 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 956a546...77cc488. Read the comment docs.

@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch 3 times, most recently from 88f8215 to c960d16 Compare January 20, 2022 12:08
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch 2 times, most recently from 75b8705 to 823f755 Compare January 24, 2022 03:30
@sofastack-bot sofastack-bot bot added size/XL and removed size/L labels Jan 24, 2022
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from 823f755 to e70bc30 Compare January 24, 2022 09:34
@sofastack-bot sofastack-bot bot added size/L and removed size/XL labels Jan 24, 2022
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from e70bc30 to 9cb497e Compare January 24, 2022 12:01
Copy link
Contributor

@OrezzerO OrezzerO left a comment

Choose a reason for hiding this comment

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

LGTM

@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from 9cb497e to bef836f Compare January 26, 2022 03:39
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from bef836f to e924f72 Compare February 8, 2022 02:30
@sofastack-bot sofastack-bot bot added size/XL and removed size/L labels Feb 8, 2022
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from e924f72 to 6b0fe53 Compare February 8, 2022 03:25
appResponse = (String) sofaResponse.getAppResponse();
Assert.assertEquals(appResponse, UNIQUE_ID_TWO);

// Case 3: There was only one invoker in UniqueIdInvoker, can not find invoker with unique id two,
Copy link
Member

Choose a reason for hiding this comment

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

We need to discuss the reasonableness of case3, I think the case of uniqueId mismatch should not fallback to other uniqueId`s invoker.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the last implement of uniqueId for triple, a server can serve request with path /{interfaceId}/{method} or '/{interfaceId}.{uniqueId}/{method}'. A client with very old version of SOFARPC may send a request with path /{interfaceId}/{method} and without uniqueId info in header. So if there is only one invoker and uniqueId is empty, we should fallback to the only invoker.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a check for if uniqueid is empty should added here.

if(StringUtils.isEmpty(uniqueId)){
    // falback
}else{
    //  throw exception
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, i will fix this

@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from 6b0fe53 to c2e8864 Compare February 10, 2022 06:58
@hui-cha hui-cha force-pushed the fet/triple_uniqueid branch from c2e8864 to 77cc488 Compare February 10, 2022 07:53
Copy link
Contributor

@OrezzerO OrezzerO left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@JervyShi JervyShi left a comment

Choose a reason for hiding this comment

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

LGTM

@JervyShi JervyShi merged commit 443b1c6 into sofastack:master Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes CLA is ok First-time contributor First-time contributor size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants