

分布式事务:网络问题+分布式机器





mysql默认级别可重复度

本地事务失效问题
同一个对象内事务方法互调默认失效,原因 绕过了代理对象,事务使用代理对象来控制的
解决: 使用代理对象来调用事务方法
1)引入aop-starter;spring-boot-starter-aop;引入aspectj
2)@EnableAspectJAutoProxy(exposeProxy = true); 开启aspectj 动态代理功能。以后所有的代理都是aspectj 对外暴露代理对象
3)本类互调用调用对象
OrderServiceImpl orderService = (OrderServiceImpl)AopContext.currentProxy();
orderService .b();
orderService .c();

微服务架构,分布式事务无法避免

只有cp 和ap 能成立
thesecretlivesofdata.com/raft/
raft 算法核心
领导选举 心跳时间,自旋时间
日志复制










网友评论