2PC的两个阶段.docVIP

  • 4
  • 0
  • 约2.08千字
  • 约 5页
  • 2016-11-27 发布于重庆
  • 举报
2PC的两个阶段

浅析SQL Server实现分布式事务的两阶段提交协议2PC 不久之前团队有个新人问我一个很重要的web服务接口如何保证事务的问题。因为涉及到跨库事务,当时我只是回答目前我们的SOA框架都不支持跨库事务。然后就问到了数据库跨库事务是如何实现的,我只能凭印象含糊回答多数是基于数据库日志(后来知道就是所谓的预写日志Write-Ahead Logging),具体数据库内部如何控制数据一致性则真的说不清楚。后来一起查了一下事务的资料,原来DB的事务控制除了基于预写日志还要实现两阶段提交协议(2PC),参考MSDN摘抄两段加深印象。 一、2PC的两个阶段 1、准备阶段(Prepare Phase) When the transaction manager receives a commit request, it sends a prepare command to all of the resource managers involved in the transaction. Each resource manager then does everything required to make the transaction durable, and all buffers holding log images for the transaction are flushed to dis

文档评论(0)

1亿VIP精品文档

相关文档