Seata AT 模式的脏读是指在全局事务未提交前,被其它业务读到已提交的分支事务的数据,本质上是Seata默认的全局事务是读未提交。
@GlobalLock 注解 + select for update +Transactional可以做到,看看源码是如何实现的?
例如我执行了select * from t_order where id = 169 for update 这个sql
由于使用了GlobalLock 注解,GlobalTransactionalInterceptor就会起作用,我们看看都做了什么?

设置全局锁标识

select for update使用这个SelectForUpdateExecutor

设置锁key

事务提交时

向tc发起请求

网友评论