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-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
Jim Gray 和 Leslie Lamport 两位图灵奖合著的论文 The distributed transaction commit ... The classic Two-Phase Commit algorithm is obtained as the special F = 0 case of the Paxos Commit algorithm.
Non-Blocking One-Phase Commit Made Possible for Distributed Transactions over Replicated Data
便携式测试工具,用于验证Java EE 6容器的XA和两阶段提交的配置。 该工具允许通过异常注入在三个XA资源管理器中进行分布式事务的压力测试,性能表征和正确的事务语义。 瘦客户端可以从命令行运行,也可以在IDE内部...
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 ...
The system tracks transaction participants and supervises an extended addressing (XA) two-phase commit protocol, ensuring that all transaction commits and rollbacks are properly handled.
2PC是指Oracle的两阶段提交协议(Two-Phase Commit protocol)。 2PC用于确保所有分布式事务能够同时提交(Commit)或者回滚(Rollback),以便使的数据库能够处于一致性状态(consistent state)。 分布式事务可以...
验证Git提交消息 根据各种预设验证提交消息安装yarn add validate-git-commit-msg -D特征即使还有其他一些程序包也可以执行此操作,但该程序包的生活质量却发生了一些变化。 让您决定如何验证提交消息(请参阅) 它...
commit-template-idea-plugin commit-template-idea-plugin commit-template-idea-plugin
里面包含了pre-commit.bat批处理和pre-commit.exe两种方式
$ validate-commit-msg创建到./lib/validate-commit-msg.js的符号链接.git/hooks/commit-msg ,该链接在每次提交时执行。 钩子脚本根据在每次提交时验证提交消息。 安装 $ npm install validate-commit-message ...
安装您可以将以下代码段复制/粘贴到.pre-commit-config.yaml文件中。 注意可以在找到更加充实的版本 # ========================================================================== # Golang Pre-Commit Hooks | ...
通过在pre-commit文件查看用户的动作来限制删除文件的动作,通过查看用户输入的log信息长度,限制用户提交log
windows环境svn服务器,提交限制文件大小脚本,pre-commit.bat,限制大小为byte
如何安装要安装钩子,请将预提交的文件复制到您的项目.git / hooks / pre-commit中: $ cp pre-commit .git / hooks / pre-commit; $ chmod + x .git / hooks / pre-commit; 该钩子带有“ die”,“ print_r”和“ ...
两阶段提交 该程序包含三个组件:1.用于在系统之间中继命令的被动服务器; 2,三名客户作为交易参与者; 3.一名客户担任交易协调员。
java-git-pre-commit-hook 一个简单的(愚蠢的)带有regex的pre-commit挂钩,用于Java / Java EE项目。
Build solid architectures without two-phase commit transactions Discover the high availability principles in microservices Who This Book Is For Java developers with basic knowledge of distributed and...
将此添加到您的.pre-commit-config.yaml - repo: git://github.com/joker8023/pre-commit-golang rev: master hooks: - id: go-fmt - id: go-vet - id: go-lint - id: go-imports - id: go-cyclo args: [-...