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。