-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
bugfix: in dubbo 3.x version, the consumer can't generate tcc proxy. #6101
Conversation
# Conflicts: # changes/en-us/2.0.0.md # changes/zh-cn/2.0.0.md # rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java # rm-datasource/src/test/java/io/seata/rm/RMHandlerATTest.java
…atic mock 2. throw exception when the db type not support in AT mode 3. add author register info
# Conflicts: # changes/zh-cn/2.x.md
2. remove tryOtherApp when get channel, so it can default use other same resourceId channel but difference app when the is no channel in same app.
� Conflicts: � changes/en-us/2.x.md � changes/zh-cn/2.x.md
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6101 +/- ##
============================================
- Coverage 48.98% 48.95% -0.04%
+ Complexity 4782 4773 -9
============================================
Files 913 913
Lines 31697 31697
Branches 3823 3823
============================================
- Hits 15528 15518 -10
- Misses 14632 14644 +12
+ Partials 1537 1535 -2
|
@@ -34,6 +34,8 @@ private DubboUtil() { | |||
private static final String ALIBABA_DUBBO_PROXY_NAME_PREFIX = "com.alibaba.dubbo.common.bytecode.proxy"; | |||
private static final String APACHE_DUBBO_PROXY_NAME_PREFIX = "org.apache.dubbo.common.bytecode.proxy"; | |||
|
|||
private static final String DUBBO_3_X_PARTIAL_PROXY_NAME = "DubboProxy"; |
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 you only use contains? and not startsWith or endsWith?
只能使用contains?而不是startsWith或者endsWith吗?
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.
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.
Deeply analyzing the source code is really excellent.
@@ -399,7 +400,7 @@ public static Channel getChannel(String resourceId, String clientId, boolean try | |||
} | |||
} | |||
|
|||
if (resultChannel == null && tryOtherApp) { | |||
if (resultChannel == null && BranchType.TCC == branchType) { |
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.
为什么要改变入参,而不是在由调用方决定是否开启tryOtherApp
Why change the entry parameter when it's up to the caller to turn on tryOtherApp?
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 feel the place convention over configuration is better, method signature is better understood without loss of flexibility.
这个地方感觉用 预定大于配置 的方法更好一点,不失灵活性的同时方法签名也更好理解.
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 feel the place convention over configuration is better, method signature is better understood without loss of flexibility. 这个地方感觉用 预定大于配置 的方法更好一点,不失灵活性的同时方法签名也更好理解.
I'm not sure if there are any other branch types that need this in the future, but if they all rely on an internal if || it's just too low.
未来不确定有没有其他的分支类型需要这种,如果都靠内部一个if || 这种写法太low了
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.
What about tryOtherApp in AT transaction mode? The original logic is that only AT mode can go here, now only TCC mode can go here?
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.
What about tryOtherApp in AT transaction mode? The original logic is that only AT mode can go here, now only TCC mode can go here?
yeah, because of TCC rpc mode regiter branch in constomer, send order of TC two stage to provider. so it can't find the channel as normal, so tcc model will try other app. @funky-eyes 's opinion there may be a risk in at to find a same resource diff app channel, ex: two instance have status.
是的,因为TCC RPC模式是在消费者端注册分支,TC在二阶段下发指令给服务者端。导致通过消费者端的app去找服务者端的channel的时候会失败,所以tcc 模式会尝试其他app channel. @funky-eyes 的建议在AT模式下发指令到相同资源不同app的端可能存在风险, 比如两台实例可能有状态的情况下.
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 feel the place convention over configuration is better, method signature is better understood without loss of flexibility. 这个地方感觉用 预定大于配置 的方法更好一点,不失灵活性的同时方法签名也更好理解.
I'm not sure if there are any other branch types that need this in the future, but if they all rely on an internal if || it's just too low. 未来不确定有没有其他的分支类型需要这种,如果都靠内部一个if || 这种写法太low了
no problem, i will rollback.
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.
What about tryOtherApp in AT transaction mode? The original logic is that only AT mode can go here, now only TCC mode can go here?
yeah, because of TCC rpc mode regiter branch in constomer, send order of TC two stage to provider. so it can't find the channel as normal, so tcc model will try other app. @funky-eyes 's opinion there may be a risk in at to find a same resource diff app channel, ex: two instance have status.
是的,因为TCC RPC模式是在消费者端注册分支,TC在二阶段下发指令给服务者端。导致通过消费者端的app去找服务者端的channel的时候会失败,所以tcc 模式会尝试其他app channel. @funky-eyes 的建议在AT模式下发指令到相同资源不同app的端可能存在风险, 比如两台实例可能有状态的情况下.
Maybe this is not the scope of this bugfix.
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.
What about tryOtherApp in AT transaction mode? The original logic is that only AT mode can go here, now only TCC mode can go here?
yeah, because of TCC rpc mode regiter branch in constomer, send order of TC two stage to provider. so it can't find the channel as normal, so tcc model will try other app. @funky-eyes 's opinion there may be a risk in at to find a same resource diff app channel, ex: two instance have status.
是的,因为TCC RPC模式是在消费者端注册分支,TC在二阶段下发指令给服务者端。导致通过消费者端的app去找服务者端的channel的时候会失败,所以tcc 模式会尝试其他app channel. @funky-eyes 的建议在AT模式下发指令到相同资源不同app的端可能存在风险, 比如两台实例可能有状态的情况下.Maybe this is not the scope of this bugfix.
tcc rpc mode can't find the channel, if no this change.
@@ -192,7 +192,7 @@ protected BranchStatus branchCommitSend(BranchCommitRequest request, GlobalSessi | |||
BranchSession branchSession) throws IOException, TimeoutException { | |||
|
|||
BranchCommitResponse response = (BranchCommitResponse) remotingServer.sendSyncRequest( | |||
branchSession.getResourceId(), branchSession.getClientId(), request, branchSession.isAT()); | |||
branchSession.getResourceId(), branchSession.getClientId(), request, branchSession.getBranchType() == BranchType.TCC); |
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.
What is the purpose of this change?
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 cannot agree with this plan. Consider what would happen if there were no multi-tenancy isolation in TCC.
A long time ago, the version is to allow tcc to be sent to other apps, and in the consumer side of the first stage of registration, the second stage in the provider side of the submission rely on this function, this pr just restore the previous practice |
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
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
Ⅰ. Describe what this PR did
#6099
Ⅱ. Does this pull request fix one issue?
fixes #6099
fixes #6096
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews