分布式数据库两阶段提交协议研究与改进
2012-04-29刘冉布辉
刘冉 布辉
摘要:分布式数据库具有可靠性和并行性等优点。在实现分布式数据库的过程中需要解决的最关键的问题是保证分布式事务的原子性、一致性、隔离性和持久性。两阶段提交协议可以解决这个问题,但是也存在一些缺陷。研究分布式数据库的事务处理机制,对基本两阶段提交协议所存在问题做了详细的分析并提出了一种两阶段提交协议的改进方案。
关键词:分布式数据库;事务;两阶段提交协议;阻塞
中图分类号:TP311文献标识码:A文章编号:1009-3044(2012)15-3500-03
Research and Improvement of Distributed Database Two-phase Commitment Protocol
LIU Ran,BU Hui
(School of Software, North China University of Water Conservancy and Electric Power,Zhengzhou 450008, China)
Abstract:The distributed database has the advantage of reliability and parallelism. Under the complex environment of distributed database systems, how to guarantee the distributed transaction atomicity, consistency, isolation and durability in the system realization, which are the key problem to solve. Two phase commitment protocol can solve this problem, but there are some defects. This thesis is on research of the distributed database affairs dealing mechanism, analysis of the problems existing in the basic two-phase commitment protocol, and putting forward one improvement program for a two-phase commitment protocol.
Key words: distributed database; affairs; two-phase commitment protocol; blocking
分布式事务具有原子性、一致性、隔离性和持久性。在分布式数据库系统中,分布式事务在各站点中被分解为子事务来执行。各子事务或者全部提交,或者全部撤销,不允许出现部分子事务提交了而其它子事务撤销的情况。为了达到这个目标,分布式事务处理程序利用两阶段提交协议来保证分布式事务的ACID特性,使分布式数据库系统具备相当的可靠性和可用性。
1基本两阶段提交协议(2PC)
在基本2PC协议中,分布式事务处理程序要任命一个协调者,该协调者负责分布式事务的提交或中止。该协调者一般由分布式事务的始发站点上的代理者担任,其它站点上的代理者被称为分布式事务的参与者,每个参与者负责其局部事务并向协调者提出提交或中止事务的请求。
基本2PC协议的基本思想是只有全部子事务均提交的情况下分布式事务才会提交;如果有一个参与者不能提交其子事务则全部子事务都中止。……
