惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
P
Proofpoint News Feed
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
I
InfoQ
月光博客
月光博客
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
D
Docker
B
Blog

博客园 - 黑米

卸载 nodejs 时报错 you must be an administrator to remove this application 的解决 真心觉得,WIN11就是一个笑话 为 centos7 编译 nginx rabbitmqctl set_permissions 报错 invalid command centos7 升级 openssh (用来避坑) 你见过最长的类名是什么 记一次 k8s master 节点被 reset 后恢复的过程 java.lang.UnsupportedOperationException: null 解决 calico/node is not ready: BIRD is not ready: BGP not established with 的问题 问题解决:idea 中无法连接 sql server 数据库,报错 [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接 用一个脚本定时清理被驱逐的pod java 里的正则表达式 为何实现了 Filter 的类,能自动添加到 filterChain 中? 如何正确填写 sonar.java.binaries 解决 Tasks support was removed in SonarQube 7.6. 的问题 部署了 prometheus, 在 target 中显示 cadvisor 与 nodes 的状态都是 down k8s 部署了 redis 集群,节点重启后,ip 变化导致集群不可用的问题 mvn deploy 到 nexus,报错 Return code is: 400, ReasonPhrase: Bad Request 关于 mybatis 的 @MapperScan 用法心得
@Transactional 和 @DSTransactional 混用可能会造成事务死锁
黑米 · 2022-07-01 · via 博客园 - 黑米

@Transactional 是 spring 中的注解。

 @DSTransactional 是 mybatis-plus 中的注解。

两者都可以控制事务处理。但不能混用!尤其是在多数据源的情况下,可能会造成事务死锁。

这个问题是怎么发现的呢?在某一次死锁的排查中,在查询数据库的锁的时候,发现对某一个表的锁是一个不同的 sessionId, 和这个事务更新其它表的 sessionId 不一样!代码刚好是在一个事务中同时用到了上面个注解!

public AService {
    @Resource
    private BService bservice;

    @DSTransactional
    public void complete(...) {
        // 其它操作
        bservice.updateBusiness();
    }
}

public BService {

    @Transactional(rollback = Throwable.class)
    public void updateBusiness(...) {
        // 其它操作
    }
}