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

tpgth1q7  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(70)
  • I have searched the 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才能支持切换不同的数据源

Ⅱ. 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:
qnzebej0

qnzebej01#

这个问题存在,我们看下如何既能向下兼容,又能修复,暂时看下是否可以将账号权限开大点,使其数据源可以控制其他schema的xa事务

相关问题