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

bugfix: add three tcc fence interceptors to fix tcc fence deadlock ex… #6706

Open
wants to merge 5 commits into
base: 2.x
Choose a base branch
from

Conversation

iAmClever
Copy link
Contributor

…ception (#6679)

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fixes #6679

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

/home/runner/work/incubator-seata/incubator-seata/spring/src/main/java/org/apache/seata/spring/annotation/GlobalTransactionScanner.java:20: Using the '.' form of import should be avoided - java.util.. [AvoidStarImport]

/**
* The constant KEY_RESOURCE_ID.
*/
public static final String KEY_RESOURCE_ID = "TX_RESOURCE_ID";
Copy link
Contributor

Choose a reason for hiding this comment

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

Rootcontext不应该用来存放这些数据
Rootcontext should not be used to store this data

@@ -42,6 +34,14 @@
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import javax.annotation.Nonnull;
Copy link
Contributor

Choose a reason for hiding this comment

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

java的包应该在顶层
Java packages should be at the top level

import org.springframework.transaction.support.TransactionTemplate;

import javax.sql.DataSource;
Copy link
Contributor

Choose a reason for hiding this comment

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

同上
ditto

* @param targetInterceptorClass the target interceptor class
* @return boolean
*/
public static boolean hasTransactionAspectBeforeInterceptor(Method method, Object proxy, Class<?> targetInterceptorClass) {
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么不在代理bean的时候就初始化好一切信息?
Why not initialize everything in the proxy bean?

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 4.98615% with 343 lines in your changes missing coverage. Please review.

Project coverage is 49.66%. Comparing base (20cd962) to head (db2073e).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6706      +/-   ##
============================================
- Coverage     50.02%   49.66%   -0.37%     
  Complexity     5734     5734              
============================================
  Files          1051     1055       +4     
  Lines         36340    36643     +303     
  Branches       4321     4369      +48     
============================================
+ Hits          18179    18198      +19     
- Misses        16365    16645     +280     
- Partials       1796     1800       +4     
Files Coverage Δ
...va/org/apache/seata/rm/tcc/TCCResourceManager.java 55.88% <100.00%> (+8.20%) ⬆️
...m/tcc/interceptor/TccActionInterceptorHandler.java 67.14% <100.00%> (ø)
...ration/tx/api/fence/DefaultCommonFenceHandler.java 0.00% <0.00%> (ø)
...ta/spring/annotation/AdapterInvocationWrapper.java 46.15% <16.66%> (-16.35%) ⬇️
.../org/apache/seata/core/model/TccLocalTxActive.java 0.00% <0.00%> (ø)
...n/tx/api/interceptor/ActionInterceptorHandler.java 11.23% <0.00%> (-1.11%) ⬇️
.../fence/interceptor/TccFencePrepareInterceptor.java 0.00% <0.00%> (ø)
...ava/org/apache/seata/core/context/RootContext.java 39.17% <0.00%> (-22.12%) ⬇️
...m/fence/interceptor/TccFenceCommitInterceptor.java 0.00% <0.00%> (ø)
...fence/interceptor/TccFenceRollbackInterceptor.java 0.00% <0.00%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

* @param bean bean
* @throws Exception
*/
private static void addTccFenceAdvisorsForBean(Object bean) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么要增加这个方法?
Why add this method?

@@ -121,6 +122,10 @@ public BranchStatus branchCommit(BranchType branchType, String xid, long branchI
Object[] args = this.getTwoPhaseCommitArgs(tccResource, businessActionContext);
Object ret;
boolean result;
RootContext.bind(xid);
Copy link
Contributor

Choose a reason for hiding this comment

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

二阶段为什么要使用rootcontext?
Why use rootcontext in Phase 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants