apache / apache/incubator-seata

seata xa事务多数据源且是动态数据源时需要修改以下地方才支持

Open
#5,627 1 comment 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
_在springboot中多数据源,且动态数据源是通过AbstractRoutingDataSource动态切换时,需为每一个手动new出来的datasource生成DataSourceProxyXA代理对象,在postgresql因为支持不同的schema,seata原代码中对resource id的处理只截取到数据库前面的字符作为resource id,这样会导致不同的schema数据源只用了一个数据源,需要seata修改以下resource id才能支持切换不同的数据源_
![image](https://github.com/seata/seata/assets/9099809/ddb26242-792a-42fd-9ed1-1e8ceb21c359)
![image](https://github.com/seata/seata/assets/9099809/c920d58a-5c87-4455-b394-496541d8d8da)

### Ⅱ. 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
2. xxx
3. xxx

Minimal yet complete reproducer code (or URL to code):

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

### Ⅵ. Environment:

- JDK version(e.g. `java -version`):
- Seata client/server version: 1.6.1
- Database version: postgresql 14.2
- OS(e.g. `uname -a`):
- Others:

Contributor guide

Open the contributing guide

Research direction

Start by tracing Seata 1.6.1's resource-ID handling for DataSourceProxyXA when AbstractRoutingDataSource switches among PostgreSQL schemas. Reproduce the multiple-datasource case and verify that each manually created datasource receives a distinct resource ID so schema-specific switching works.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql, spring-boot
Domain
backend, databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.