apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.37k stars 8.79k forks source link

seata1.5.2多数据源自动代理导致服务端lock表主键冲突 #5147

Closed crazy-sheep closed 1 year ago

crazy-sheep commented 1 year ago

Ⅰ. Issue Description

多数据源示例demo multiple-datasorce去除手动数据源代理,引入seata-spring-boot-starter,调用接口操作数据库报错 pom文件 datasourceProxyConfig

客户端异常日志

服务端日志

原因:通过继承AbstractRoutingDataSource类,会把自定义dynamicDataSource类的defaultTargetDataSource也代理一次,服务端会收到重复的数据源代理 服务端注册日志

解决方式:代理数据源时跳过AbstractRoutingDataSource类型的数据源 image

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

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

funky-eyes commented 1 year ago

假设RoutingDataSource是一个主备datasource?请问如何区分? 或者读写分离的datasource,在与tcc混用下即便是从库也应该checklock

funky-eyes commented 1 year ago

seata本身要求类似mp提供的动态数据源这类功能包括sharding-jdbc这类都是要关闭自动代理