Skip to content

Conversation

@xiaoxiangyeyu0
Copy link
Contributor

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fix #7690

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.53%. Comparing base (9b97559) to head (cff37a0).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7708      +/-   ##
============================================
+ Coverage     61.41%   61.53%   +0.11%     
+ Complexity      682      680       -2     
============================================
  Files          1324     1324              
  Lines         50047    50045       -2     
  Branches       5910     5910              
============================================
+ Hits          30738    30796      +58     
+ Misses        16531    16447      -84     
- Partials       2778     2802      +24     
Files with missing lines Coverage Δ
...ache/seata/rm/datasource/xa/ConnectionProxyXA.java 48.48% <100.00%> (-0.52%) ⬇️

... and 43 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

PRs need to be registered, and the title must clearly describe the change — not just be an issue link.

@funky-eyes funky-eyes requested a review from Copilot October 20, 2025 08:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #7690 by fixing the XA transaction state management in the ConnectionProxyXA class. The change replaces the xaEnded flag with the existing xaActive flag to more accurately track XA transaction state and prevent redundant XA end operations.

Key Changes:

  • Removed the redundant xaEnded volatile boolean field
  • Modified xaEnd() method to check xaActive flag instead of xaEnded
  • Updated the flag management to set xaActive = false after ending the XA transaction

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@xiaoxiangyeyu0 xiaoxiangyeyu0 changed the title bugfix:fix https://github.com/apache/incubator-seata/issues/7690 bugfix:Use xaActive to determine whether xaResource needs to execute the end method Oct 20, 2025
shukai added 3 commits October 20, 2025 17:14
# Conflicts:
#	changes/en-us/2.x.md
#	changes/zh-cn/2.x.md
@xiaoxiangyeyu0
Copy link
Contributor Author

PRs need to be registered, and the title must clearly describe the change — not just be an issue link.

done

@xiaoxiangyeyu0
Copy link
Contributor Author

如下测试场景通过
1、pg数据库,加上@GlobalTransactional,正常提交事务成功。
2、pg数据库,加上@GlobalTransactional,报错回滚成功。
3、pg数据库,加上@GlobalTransactional,超时回滚成功。
4、pg数据库,加上@GlobalTransactional和@transactional注解,正常提交事务成功。
5、pg数据库,加上@GlobalTransactional和@transactional注解,报错回滚成功。
6、pg数据库,加上@GlobalTransactional和@transactional注解,超时回滚成功。
7、mysql5.7数据库,加上@GlobalTransactional,正常提交事务成功。
8、mysql5.7数据库,加上@GlobalTransactional,报错回滚成功。
9、mysql5.7数据库,加上@GlobalTransactional,超时回滚成功。
10、mysql5.7数据库,加上@GlobalTransactional和@transactional注解,正常提交事务成功。
11、mysql5.7数据库,加上@GlobalTransactional和@transactional注解,报错回滚成功。
12、mysql5.7数据库,加上@GlobalTransactional和@transactional注解,超时回滚成功。
The following test scenarios passed successfully:

  1. In the PostgreSQL database, adding the @GlobalTransactional annotation resulted in a successful, normal transaction commit.
  2. Again in the PostgreSQL database, applying @GlobalTransactional led to an error, but the rollback was executed successfully.
  3. Still in PostgreSQL, when @GlobalTransactional was combined with a timeout setting, the rollback occurred as expected.
  4. In the PostgreSQL database, using both @GlobalTransactional and the @Transactional annotation allowed for a successful, normal transaction commit.
  5. In PostgreSQL, combining @GlobalTransactional with @Transactional triggered an error, yet the rollback proceeded without issues.
  6. Once more in PostgreSQL, integrating @GlobalTransactional along with @Transactional and introducing a timeout caused the rollback to complete successfully.
  7. In the MySQL 5.7 database, adding the @GlobalTransactional annotation resulted in a successful, normal transaction commit.
  8. In MySQL 5.7, incorporating @GlobalTransactional led to an error, but the rollback was handled successfully.
  9. Also in MySQL 5.7, when @GlobalTransactional was used alongside a timeout, the rollback completed as expected.
  10. In the MySQL 5.7 database, employing both @GlobalTransactional and @Transactional annotations enabled a successful, normal transaction commit.
  11. In MySQL 5.7, combining @GlobalTransactional with @Transactional caused an error, though the rollback was still executed successfully.
  12. Finally, in MySQL 5.7, using @GlobalTransactional with @Transactional and a timeout setting resulted in a successful rollback.

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.

TC下发回滚,执行xaRollback报错

2 participants