Thanks to visit codestin.com
Credit goes to github.com

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 69.92%. Comparing base (1b63dd0) to head (63539f6).
⚠️ Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7708      +/-   ##
============================================
- Coverage     69.94%   69.92%   -0.02%     
+ Complexity      994      992       -2     
============================================
  Files          1322     1322              
  Lines         50177    50175       -2     
  Branches       5932     5932              
============================================
- Hits          35095    35084      -11     
- Misses        12144    12157      +13     
+ Partials       2938     2934       -4     
Files with missing lines Coverage Δ
...ache/seata/rm/datasource/xa/ConnectionProxyXA.java 48.48% <100.00%> (-0.52%) ⬇️

... and 12 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
Contributor

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.

@funky-eyes funky-eyes added this to the 2.6.0 milestone Nov 20, 2025
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. mode: XA XA transaction mode module/rm-datasource rm-datasource module labels Nov 20, 2025
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.

LGTM

@funky-eyes funky-eyes merged commit 4959cfb into apache:2.x Nov 20, 2025
11 checks passed
@funky-eyes funky-eyes changed the title bugfix:Use xaActive to determine whether xaResource needs to execute the end method bugfix: Use xaActive to determine whether xaResource needs to execute the end method Nov 20, 2025
diguage pushed a commit to diguage/seata that referenced this pull request Nov 26, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mode: XA XA transaction mode module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TC下发回滚,执行xaRollback报错

2 participants