Atomic commit
From Wikipedia, the free encyclopedia
This article does not cite any references or sources. (February 2007) Please help improve this article by adding citations to reliable sources. Unverifiable material may be challenged and removed. |
An atomic commit is an operation where a set of distinct changes is applied as a single operation. If the atomic commit succeeds, it means that all the changes have been applied. If there is a failure before the atomic commit can be completed, such as the Internet line disconnecting or a conflict that cannot be automatically resolved, the "commit" is aborted and all changes that have taken place are reversed (rolled back). In either case, atomic commit leaves the system in a consistent state. The word atom is used in its classical sense: an indivisible unit.
It has been proven that no algorithm can solve the problem via the proof of the Two Generals' Problem. However, the Two-phase commit protocol and Three-phase commit protocol are some of the algorithms that can help with some of the atomic commitment problems.
Nowadays, atomic commit is mostly encountered in database systems when committing multiple sets of changes at once. These changes can be just different update statements to the same table or changes that span over multiple databases.
Atomic commit is supported also by modern revision control systems and allows committing—uploading to the source—changes in multiple files (called a changeset) while guaranteeing that all files get fully uploaded and merged. In an atomic commit, typically the files that are committed together are concerned with a single modification, and everything changed in that modification should be included in the commit. In this way, the code trunk stays stable; people who update their working copy do not miss changes left to be committed in somebody else's working copy; the changeset is not too messy to read through; and if the atomic commit is rolled back, the single modification is removed entirely from all parts of the code base.