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

feature: save tcc action context to fencelog #5272

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

Conversation

pengten
Copy link
Contributor

@pengten pengten commented Jan 31, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

添加TCC上下文存储SPI扩展能力,并扩展实现将TCC的actionContext数据存储到本地防悬挂表中。

目前TCC在方悬挂情况下,如果一阶段有三方接口调用,TCC无法进入二阶段回滚。该类问题可以参阅#4532

oldPr: #4527

Ⅱ. Does this pull request fix one issue?

fixes #4423

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pengten pengten force-pushed the 2.x_feature_save_app_to_fencelog branch from 4373986 to c796d4c Compare February 5, 2023 02:57
@pengten
Copy link
Contributor Author

pengten commented Feb 5, 2023

如果缺少’application_data‘字段,这里给出了如下提示
image

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2023

Codecov Report

Merging #5272 (fc5717e) into 2.x (e69627d) will decrease coverage by 0.38%.
The diff coverage is 7.59%.

❗ Current head fc5717e differs from pull request most recent head e78a2f7. Consider uploading reports for the commit e78a2f7 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #5272      +/-   ##
============================================
- Coverage     48.73%   48.35%   -0.38%     
+ Complexity     4339     4316      -23     
============================================
  Files           778      782       +4     
  Lines         27454    27523      +69     
  Branches       3412     3419       +7     
============================================
- Hits          13380    13310      -70     
- Misses        12677    12813     +136     
- Partials       1397     1400       +3     
Impacted Files Coverage Δ
...c/main/java/io/seata/common/ConfigurationKeys.java 0.00% <ø> (ø)
...ommon/src/main/java/io/seata/common/Constants.java 100.00% <ø> (ø)
...n/src/main/java/io/seata/common/DefaultValues.java 0.00% <ø> (ø)
...seata/common/exception/ContextReportException.java 0.00% <0.00%> (ø)
...io/seata/common/exception/DataAccessException.java 83.33% <0.00%> (-16.67%) ⬇️
...ration/tx/api/fence/DefaultCommonFenceHandler.java 0.00% <ø> (ø)
...pi/fence/store/db/CommonFenceStoreDataBaseDAO.java 0.00% <0.00%> (ø)
...x/api/fence/store/db/sql/CommonFenceStoreSqls.java 0.00% <0.00%> (ø)
...ava/io/seata/rm/tcc/api/BusinessActionContext.java 0.00% <0.00%> (ø)
...io/seata/rm/tcc/api/BusinessActionContextUtil.java 0.00% <0.00%> (ø)
... and 10 more

... and 25 files with indirect coverage changes

@@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS `tcc_fence_log`
`branch_id` BIGINT NOT NULL COMMENT 'branch id',
`action_name` VARCHAR(64) NOT NULL COMMENT 'action name',
`status` TINYINT NOT NULL COMMENT 'status(tried:1;committed:2;rollbacked:3;suspended:4)',
`application_data` varchar(2000) DEFAULT NULL COMMENT 'the application context',
Copy link
Contributor

Choose a reason for hiding this comment

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

启动的时候建议select * 这个表,看看有没有application_data列,没有的话要默认为tc存储方式

Copy link
Contributor Author

Choose a reason for hiding this comment

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

既然用户主动设置了fence存储,说明用户是有主观意愿要切换存储的,这时候如果没有字段属于用户自身的遗漏,应该把异常抛给用户保证其第一时间发现问题。

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.

需要将多次report的数据合并写入fence表或tc,并且需要限制次数

@pengten pengten force-pushed the 2.x_feature_save_app_to_fencelog branch from ec62718 to 9fbcb3b Compare February 26, 2023 04:14
@pengten
Copy link
Contributor Author

pengten commented Feb 26, 2023

Seata上下文存储扩展

@pengten pengten force-pushed the 2.x_feature_save_app_to_fencelog branch from fc5717e to 9cc7d4e Compare May 25, 2023 08:20
@pengten pengten force-pushed the 2.x_feature_save_app_to_fencelog branch from 9cc7d4e to c16f319 Compare July 17, 2023 14:40
@funky-eyes funky-eyes added this to the 2.x Backlog milestone Nov 7, 2023
@funky-eyes funky-eyes added type: feature Category issues or prs related to feature request. mode: TCC TCC transaction mode module/tcc tcc module labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mode: TCC TCC transaction mode module/tcc tcc module type: feature Category issues or prs related to feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tcc support one-phase data storage that stores local table
3 participants