分布式事务概述

      A distributed transaction is a database transaction in which two or more network hosts are involved. Usually, hosts provide transactional resources, while the transaction manager is responsible for creating and managing a global transaction that encompasses all operations against such resources. Distributed transactions, as any other transactions, must have all four ACID (atomicity, consistency, isolation, durability) properties, where atomicity guarantees all-or-nothing outcomes for the unit of work (operations bundle).

      摘自wiki百科,大致意思是分布式事务和普通事务一样拥有ACID特性,只不过是涉及到多个网络节点的事务。其中提到了Host和Transaction manager。

       OpenGroup是一个供应商联盟,它提出了x/open分布式事务处理(DTP)模型(x/open xa),成为事务模型组件行为的的标准。

       In practice most commercial database systems use strong strict two phase locking (SS2PL) for concurrency control, which ensures global serializability, if all the participating databases employ it. (see also commitment ordering for multidatabases.)

      这里提到了大多数商业数据库系统使用强严格的两阶段锁定(Ss2pl)来进行并发控制,也就是俗说的二阶段提交。

      但是2PC(二阶段提交并不适用所有场景),比方说预定机票和预订酒店这种,用2PC的方式并不合适,这种长时间的分布式事务会锁定较长的时间,而且有技术层面上锁的撤销操作,这种可以从业务上避免分布式事务,比方说业务上添加一个撤销操作。通常,这些长时间的事务采用补偿事务、乐观和不锁定隔离的方案。X/Open模型不适合长期存在的DTP。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值