`
ceci.lia
  • 浏览: 144785 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

What is two-phase commit

    博客分类:
  • Wiki
阅读更多
A commit operation is, by definition, an all-or-nothing affair. If a series of operations bound as a transaction cannot be completed, the rollback must restore the system (or cooperating systems) to the pre-transaction state.

In order to ensure that a transaction can be rolled back, a software system typically logs each operation, including the commit operation itself. A transaction/recovery manager uses the log records to undo (and possibly redo) a partially completed transaction.

When a transaction involves multiple distributed resources, for example, a database server on each of two different network hosts, the commit process is somewhat complex because the transaction includes operations that span two distinct software systems, each with its own resource manager, log records, and so on. (In this case, the distributed resources are the database servers.)

Two-phase commit is a transaction protocol designed for the complications that arise with distributed resource managers. With a two-phase commit protocol, the distributed transaction manager employs a coordinator to manage the individual resource managers.

The commit process proceeds as follows:

Phase 1
Each participating resource manager coordinates local operations and forces all log records out:
If successful, respond "OK"
If unsuccessful, either allow a time-out or respond "OOPS"
Phase 2
If all participants respond "OK":
Coordinator instructs participating resource managers to "COMMIT"
Participants complete operation writing the log record for the commit
Otherwise:
Coordinator instructs participating resource managers to "ROLLBACK"
Participants complete their respective local undos
In order for the scheme to work reliably, both the coordinator and the participating resource managers independently must be able to guarantee proper completion, including any necessary restart/redo operations. The algorithms for guaranteeing success by handling failures at any stage are provided in advanced database texts.


分享到:
评论
1 楼 xianqi_h 2010-07-19  
good!

相关推荐

    1-2PC-The-one-two-phase-atomic-commit-protocol.pdf

    1-2PC the one-two phase atomic commit protocol; 1-2PC the one-two phase atomic commit protocol 1-2PC the one-two phase atomic commit protocol

    Implementing a Distributed Two-Phase-Commit Scenario with Web Services and SAP NetWeaver PI 7.1.pdf

    本文档介绍了如何在SAP NetWeaver Process Integration (PI) 7.1版本中实现分布式两阶段提交(Two-Phase Commit, TPC)场景。两阶段提交是一种用于确保分布式系统中事务一致性的重要协议。它通常被应用于需要跨多个...

    SVN钩子 之 pre-commit

    `pre-commit.bat` 和 `pre-commit2.bat` 是两种可能的批处理文件,通常用于Windows环境。这些批处理文件包含了一组命令,当用户尝试提交时,这些命令会执行。例如,它们可以检查提交的文件是否遵循编码规范,是否有...

    Java EE Two-Phase Commit Testkit:用于XA / 2PC测试的便携式瘦客户机和服务器对-开源

    便携式测试工具,用于验证Java EE 6容器的XA和两阶段提交的配置。 该工具允许通过异常注入在三个XA资源管理器中进行分布式事务的压力测试,性能表征和正确的事务语义。 瘦客户端可以从命令行运行,也可以在IDE内部...

    Non-Blocking One-Phase Commit Made Possible for Distributed Transactions over Replicated Data

    在传统的两阶段提交协议(Two-Phase Commit,简称2PC)基础上,NBOPC通过移除准备阶段(Prepare Phase),减少了通信和日志记录的成本。在没有客户端故障的情况下,NBOPC能够在一次通信往返内完成事务提交;即使发生...

    pre-push commit规范检查

    pre-push commit规范检查

    Android代码-maven-git-commit-id-plugin

    maven git commit id plugin git-commit-id-plugin is a plugin quite similar to ...I had to quickly develop an git version of such a plugin. For those who don't know the previous plugins, it basically ...

    pre-commit:自动在您的git仓库中安装一个git pre-commit脚本,该脚本在pre-commit时运行您的`npm test`。

    预先提交 pre-commit是git的预提交钩子安装程序。 在提交更改之前,它将确保您的npm test (或其他指定的脚本)通过。 所有这些都可以在package.json方便地配置。 但是不用担心,您仍然可以通过告诉git只需使用--no-...

    subversion中的pre-commit.bat

    Subversion 中的 pre-commit.bat Subversion 中的 Hook 机制是指在客户端与服务器端之间的交互过程中,服务器端可以根据需要执行某些操作,以确保提交的合法性和正确性。这些操作称为 Hook SCRIPT,其中包括 pre-...

    前端开源库-guppy-pre-commit

    2. **配置**:在项目根目录下创建或更新 `.guppy-pre-commit-config.js` 文件,配置所需的检查和任务。 3. **激活**:在项目中设置 Git 预提交挂钩,通常是在 `.git/hooks/pre-commit` 文件中添加执行 guppy-pre-...

    validate-commit-message:GIT COMMIT-MSG挂钩,用于验证提交消息

    $ validate-commit-msg创建到./lib/validate-commit-msg.js的符号链接.git/hooks/commit-msg ,该链接在每次提交时执行。 钩子脚本根据在每次提交时验证提交消息。 安装 $ npm install validate-commit-message ...

    svn hook pre-commit禁止删除文件和强制添加注释

    ### SVN Hook预提交(pre-commit)控制机制:禁止删除文件与强制添加注释 #### 一、SVN(Subversion)简介 SVN 是一个集中式的版本控制系统,它可以帮助团队管理和跟踪项目的开发过程。通过SVN,开发人员可以保存...

    2-Phase-Commit

    两阶段提交(2-Phase Commit,2PC)是一种分布式事务处理协议,用于确保在分布式系统中的所有参与者就是否执行一个事务达成一致。这种协议在分布式数据库、多节点协作的场景中非常常见,尤其是在金融系统、数据库...

    前端开源库-git-pre-commit

    在压缩包文件名称“git-pre-commit-master”中,“master”通常代表了项目的主分支,这是项目的主要开发分支,包含了最新的稳定代码。下载并解压这个文件后,开发者可以找到项目的源代码,了解如何配置和使用`git-...

    validate-git-commit-msg

    验证Git提交消息 根据各种预设验证提交消息安装yarn add validate-git-commit-msg -D特征即使还有其他一些程序包也可以执行此操作,但该程序包的生活质量却发生了一些变化。 让您决定如何验证提交消息(请参阅) 它...

    commit-template-idea-plugin.jar

    commit-template-idea-plugin commit-template-idea-plugin commit-template-idea-plugin

    pre-commit.bat

    windows环境svn服务器,提交限制文件大小脚本,pre-commit.bat,限制大小为byte

    what-the-commit.el:该程序包从“ whatthecommit.com”获取随机提交消息,并将其添加到您的kill ring中

    在使用`what-the-commit.el`时,首先需要将压缩包中的文件`what-the-commit.el-master`解压,并将里面的源码文件添加到Emacs的加载路径中。通常,这可以通过配置Emacs的初始化文件(`.emacs`或`init.el`)来完成,将...

    pre-commit-golang:Golang的Pre-Commit钩子,支持模块

    安装您可以将以下代码段复制/粘贴到.pre-commit-config.yaml文件中。 注意可以在找到更加充实的版本 # ========================================================================== # Golang Pre-Commit Hooks | ...

Global site tag (gtag.js) - Google Analytics