Content deleted Content added
fixed wrong link |
No edit summary |
||
Line 4:
The problem with atomic commits is that they require coordination between multiple systems.<ref>{{cite book |last=Bocchi |first=Wischik |title=A Process Calculus of Atomic Commit |year=2004}}</ref> As computer networks are unreliable services this means no algorithm can coordinate with all systems as proven in the [[Two Generals' Problem|Two Generals Problem]]. As databases become more and more distributed this coordination will increase the difficulty of making truly atomic commits.<ref>{{cite book |first1=Hector |last1=Garcia-Molina |first2=Jeff |last2=Ullman |first3=Jennifer |last3=Widom |title=Database Systems The Complete Book |pages=1008–1009 |publisher=Prentice Hall |year=2009}}</ref>
==
Atomic commits are essential for multi-step updates to data. This can be clearly shown in a simple example of a money transfer between two checking accounts.<ref>{{Cite book |first1=Hector |last1=Garcia-Molina |first2=Jeff |last2=Ullman |first3=Jennifer |last3=Widom |title=Database Systems The Complete Book |page=299 |publisher=Prentice Hall |year=2009}}</ref>
Line 12 ⟶ 11:
With atomic commits neither of these cases can happen, in the first case of the system failure, the atomic commit would be rolled back and the money returned to X. In the second case, the request of the balance of Y cannot occur until the atomic commit is fully completed.
==
Atomic commits in database systems fulfil two of the key properties of [[ACID]],<ref>{{cite book |last=Elmasri |first=Ramez |title=Fundamentals of Database Systems 5th Edition |page=620 |publisher=Addison Wesley |year=2006}}</ref> [[Atomicity (database systems)|atomicity]] and [[Consistency (database systems)|consistency]]. Consistency is only achieved if each change in the atomic commit is consistent.
Line 33 ⟶ 31:
commit message to each node. When each node receives this message it performs the actual commit. If the commit message does not reach a node due to the message being lost or the coordinator fails they will perform the commit if the timeout expires. If the coordinator fails upon recovery it will send a commit message to each node.<ref>{{cite book |first=Srinivas R. |last=Gaddam |title=Three-Phase Commit Protocol |url=http://ei.cs.vt.edu/~cs5204/fall99/distributedDBMS/sreenu/3pc.html}}</ref>
==
The other area where atomic commits are employed is [[revision control]] systems. This allows multiple modified files to be uploaded and merged into the source. Most revision control systems support atomic commits ([[Concurrent Versions System|CVS]], [[Microsoft Visual SourceSafe|VSS]] and [[IBM Rational ClearCase]] (when in [[IBM Rational ClearCase UCM|UCM]] mode
<ref>http://pic.dhe.ibm.com/infocenter/cchelp/v8r0m0/topic/com.ibm.rational.clearcase.ccrc.help.doc/topics/u_checkin.htm?resultof=%22%61%74%6f%6d%69%63%22%20%22%61%74%6f%6d%22%20%22%63%6f%6d%6d%69%74%22%20</ref>) are the major exceptions).
Line 42 ⟶ 39:
Atomic commits are crucial for maintaining a consistent state in the repository. Without atomic commits some changes a developer has made may be applied but other changes may not. If these changes have any kind of coupling this will result in errors. Atomic commits prevent this by not applying partial changes which would create these errors. Note that if the changes already contain errors, atomic commits offer no fix.
==
When using a revision control systems a common convention is to use small commits. These are sometimes referred to as atomic commits as they (ideally) only affect a single aspect of the system. These atomic commits allow for greater understandability, less effort to roll back changes, easier bug identification.<ref>{{cite web |publisher=Apache |title=Subversion Best Practices |url=http://svn.apache.org/repos/asf/subversion/trunk/doc/user/svn-best-practices.html}}</ref>
Line 51 ⟶ 47:
Atomic commits also allow bug fixes to be easily reviewed if only a single bug fixes committed at a time. Instead of having to check multiple potentially unrelated files the reviewer must only check files and changes that directly impact the bug being fixed. This also means that bug fixes can be easily packaged for testing as only the changes that fix the bug are in the commit.
==References==▼
{{Reflist|2}}▼
==See also==
Line 60 ⟶ 53:
*[[Commit (data management)]]
*[[Atomic operation]]
▲==References==
▲{{Reflist|2}}
[[Category:Transaction processing]]
|