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: Saga can't be used when the dataSource is AT's dataSourceProxy #2551

Merged
merged 104 commits into from
Sep 23, 2020

Conversation

wangliang181230
Copy link
Contributor

@wangliang181230 wangliang181230 commented Apr 14, 2020

Ⅰ. Describe what this PR did

bugfix: SAGA can't be used when the dataSource is AT's dataSourceProxy。
修复BUG:当数据源是AT数据源代理时,无法正常使用SAGA模式。

修复方式

模仿TCC模式,在SAGA事务内,RootContext.bindBranchType(BranchType.SAGA),以此使AT模式无效化。

Ⅱ. Does this pull request fix one issue?

fixes #2009

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

Ⅳ. Describe how to verify it

测试以下三项内容,如果都正确,则说明此PR修复BUG成功。

  1. 在同一项目中同时启用SAGA和AT模式,并分别测试AT模式和SAGA模式,都能够正常运行。
  2. 在SAGA模式中,不会创建AT/XA/TCC分支事务。
  3. 在SAGA事务中,分别使用同步执行和异步执行,在正向服务中,RootContext.getXID()都有值,RootContext.getBranchType()都为SAGA。

Ⅴ. Special notes for reviews

@long187
Copy link
Contributor

long187 commented Apr 14, 2020

先把缩进调整一下吧,没有改支的代码也显示修改了

@wangliang181230
Copy link
Contributor Author

wangliang181230 commented Apr 14, 2020 via email

@wangliang181230
Copy link
Contributor Author

已调整所有未做过调整的代码行的缩进。

RootContextTest.java:add test method testWithoutGlobalTransaction().
@wangliang181230 wangliang181230 changed the title 允许SAGA模式与AT模式在同一项目中使用,同时SAGA事务中,禁用AT和TCC模式。 SAGA mode is compatible with AT mode in same application. Apr 15, 2020
@wangliang181230 wangliang181230 changed the title SAGA mode is compatible with AT mode in same application. optimize: SAGA mode is compatible with AT mode in same application. Apr 15, 2020
@funky-eyes
Copy link
Contributor

代码格式化按照p3c规范.

@wangliang181230
Copy link
Contributor Author

好像符合p3c规范的。我下了alibaba的idea插件了。

2.添加SeataSagaAutoConfiguration类(默认禁用).
3.代码按p3c规范调整.
@wangliang181230 wangliang181230 changed the title optimize: SAGA mode is compatible with AT mode in same application. optimize: SAGA mode is compatible with AT mode in same application, and added SeataSagaAutoConfiguration.class. Apr 15, 2020
@wangliang181230
Copy link
Contributor Author

新修改:
1.saga DefaultStateMachineConfig resources 资源文件读取,支持通配符配置.
2.添加SeataSagaAutoConfiguration类(默认禁用).

@codecov-io
Copy link

codecov-io commented Apr 15, 2020

Codecov Report

Merging #2551 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #2551   +/-   ##
==========================================
  Coverage      50.67%   50.67%           
  Complexity      2813     2813           
==========================================
  Files            561      561           
  Lines          17983    17983           
  Branches        2128     2128           
==========================================
  Hits            9113     9113           
  Misses          8000     8000           
  Partials         870      870           

@wangliang181230 wangliang181230 changed the title optimize: SAGA is compatible with AT in the same application bugfix: fix Saga can't be used, cause of AT's dataSourceProxy Aug 21, 2020
@wangliang181230 wangliang181230 changed the title bugfix: fix Saga can't be used, cause of AT's dataSourceProxy bugfix: fix SAGA can't be used, cause of AT's dataSourceProxy Aug 21, 2020
@wangliang181230 wangliang181230 changed the title bugfix: fix SAGA can't be used, cause of AT's dataSourceProxy bugfix: SAGA can't be used when the dataSource is AT's dataSourceProxy Aug 21, 2020
@funky-eyes funky-eyes added this to the 1.4.0 milestone Aug 26, 2020
wangliang181230 and others added 3 commits September 15, 2020 10:52
# Conflicts:
#	core/src/main/java/io/seata/core/context/RootContext.java
#	spring/src/main/java/io/seata/spring/tcc/TccActionInterceptor.java
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly changed the title bugfix: SAGA can't be used when the dataSource is AT's dataSourceProxy bugfix: Saga can't be used when the dataSource is AT's dataSourceProxy Sep 23, 2020
@slievrly slievrly merged commit d0a4d49 into apache:develop Sep 23, 2020
@wangliang181230 wangliang181230 deleted the develop branch September 23, 2020 05:46
@wangliang181230 wangliang181230 added type: bug Category issues or prs related to bug. and removed module/core core module module/script script module module/seata-spring-boot-starter seata-spring-boot-starter module module/spring spring module labels Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/saga saga module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

saga与at事务无法使用同一数据源
9 participants