两阶段提交如何在原子事务中工作?
How two phase commit is working in atomic transaction?
我对两阶段提交协议有一些疑问,
1.What第二阶段提交失败会怎样?
2.How它保持容错?
提前致谢。
来自 Two-phase commit protocol 的回答。
What will it do on the failure of second phase commit?
提交阶段失败处理如下:
If any cohort votes No during the commit-request phase (or the coordinator's timeout expires):
- The coordinator sends a rollback message to all the cohorts.
- Each cohort undoes the transaction using the undo log, and releases
the resources and locks held during the transaction.
- Each cohort
sends an acknowledgement to the coordinator.
- The coordinator undoes
the transaction when all acknowledgements have been received.
How it maintains the fault tolerance?
在很多情况下它不需要,并且可能需要人工干预:
it is not resilient to all possible failure configurations, and in rare cases user (e.g., a system's administrator) intervention is needed to remedy an outcome. To accommodate recovery from failure (automatic in most cases) the protocol's participants use logging of the protocol's states. Log records, which are typically slow to generate but survive failures, are used by the protocol's recovery procedures. Many protocol variants exist that primarily differ in logging strategies and recovery mechanisms. Though usually intended to be used infrequently, recovery procedures compose a substantial portion of the protocol, due to many possible failure scenarios to be considered and supported by the protocol.
我对两阶段提交协议有一些疑问,
1.What第二阶段提交失败会怎样?
2.How它保持容错?
提前致谢。
来自 Two-phase commit protocol 的回答。
What will it do on the failure of second phase commit?
提交阶段失败处理如下:
If any cohort votes No during the commit-request phase (or the coordinator's timeout expires):
- The coordinator sends a rollback message to all the cohorts.
- Each cohort undoes the transaction using the undo log, and releases the resources and locks held during the transaction.
- Each cohort sends an acknowledgement to the coordinator.
- The coordinator undoes the transaction when all acknowledgements have been received.
How it maintains the fault tolerance?
在很多情况下它不需要,并且可能需要人工干预:
it is not resilient to all possible failure configurations, and in rare cases user (e.g., a system's administrator) intervention is needed to remedy an outcome. To accommodate recovery from failure (automatic in most cases) the protocol's participants use logging of the protocol's states. Log records, which are typically slow to generate but survive failures, are used by the protocol's recovery procedures. Many protocol variants exist that primarily differ in logging strategies and recovery mechanisms. Though usually intended to be used infrequently, recovery procedures compose a substantial portion of the protocol, due to many possible failure scenarios to be considered and supported by the protocol.