wangjiandahai opened a new issue, #24898:
URL: https://github.com/apache/shardingsphere/issues/24898
## Bug Report
### Actual behavior
When use seata-at as base tansaction type .
transaction config:
```yaml
- !TRANSACTION
defaultType: LOCAL
```
spring boot datasource config:
```yaml
spring:
datasource:
driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
url: jdbc:shardingsphere:classpath:sharding.yaml
```
use HikariDataSource。
one businesss code use LOCAL, another businesss code use BASE like:
```java
@PostMapping(value = "addLocal")
public Result add(@RequestBody OrderAddReq req) {
return ResultTools.ofSuccess(orderService.add(req));
}
@PostMapping(value = "addBase")
public Result add(@RequestBody OrderAddReq req) {
TransactionTypeHolder.set(TransactionType.BASE);
return ResultTools.ofSuccess(orderService.add(req));
}
```
```java
@Transactional(rollbackFor = Exception.class)
public boolean add(OrderAddReq req) {
log.info("Seata全局事务id=================>{}", RootContext.getXID());
OrderEntity order = new OrderEntity();
order.setProductId(req.getProductId());
order.setMoney(req.getMoney());
order.setUserId(req.getUserId());
order.setCount(req.getCount());
order.setStatus(0);
this.baseOrderService.save(order);
AccountOpReq accountOpReq = new AccountOpReq();
accountOpReq.setUserId(req.getUserId());
accountOpReq.setMoney(req.getMoney());
Result<?> result = accountApi.accountOp(accountOpReq);
if(!result.success()){
throw new BaseFlowException(result.getMsg());
}
if(req.getCount() == 10000){
int i = 1/0;
}
return true;
}
```
When call local mode api first,use Local mode ,then call base mode api,it
will use Local mode。
### Reason analyze (If you can)
**5.3 use jdbc driver mode,HikariDataSource will pool
ShardingSphereConnections. but Connection's Transaction manager is setted when
Connection create,will not change。**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]