apache / apache/incubator-seata

【Help】TCC 最佳实践及一些困惑

Open
#5,465 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
现在在 seata-samples 中 tcc 模块下所有测试用例都是在接口上添加 tcc 注解,但是最佳实践好像又不是这样使用的所有有了以下几个问题,希望能得到答复
1. #4479 这个pr为了解决什么问题,因为这里是可以在实现类上添加tcc注解了,优化了什么,tcc上的使用有什么变化
2. #3823 这个pr支持tcc commit/rollback方法属性填充,那针对参数类型为基本类型、List 这种,在commitArgs/RollbackArgs中ClassType填什么呢?
同时官方推荐使用这种方式还是获取上下文自己get(key)的方式呢?
3. tcc useTCCFence=true开启后,把悬挂/空回滚/幂等问题都解决了吗
4. #4888 issue,rpc框架重试,导致分支事务多次注册这个问题?但是其实我没想明白怎么复现这个问题,我对dubbo不太熟悉
这里提到了最佳实践:
最佳实践->tcc的注解写在provider的service上,并且在provider的controller等位置再调用service之前进行`幂等处理`避免进入seata-tcc注解切面进行多次分支事务注册

但是还是需要用户做幂等处理

5. springcloud/ springboot 服务之间http调用如何使用tcc?
目前我看源码是在调用方添加@LocalTCC注解,但是我认为跟injvm联系不上。这次我再次困惑@LocalTCC的含义是啥
6. 目前添加tcc切面bean的逻辑,我的理解是:
一个在该类上含有@LocalTCC
一个在该类上是referenceFactoryBean
为什么要做这两者的区别?就是为什么referenceFactoryBean不统一添加@LocalTCC统一方式?LocalTCC有啥特殊的含义吗?
7. 所以能提供一个TCC的最佳实践官方文档吗?

### Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

```
Just paste your stack trace here!
```

### Ⅲ. Describe what you expected to happen

### Ⅳ. How to reproduce it (as minimally and precisely as possible)

1. xxx
3. xxx
4. xxx

### Ⅴ. Anything else we need to know?

### Ⅵ. Environment:

- JDK version :
- Seata version:
- OS :
- Others:

Contributor guide

Open the contributing guide

Research direction

Start with the TCC tests under seata-samples and read the referenced PRs #4479 and #3823 plus issue #4888. Trace the annotations and TCC behavior discussed in the seven questions, including fencing, retries, LocalTCC, and HTTP calls. Done means a reviewed official best-practices document answers these questions with supported examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
distributed-systems, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.