<s>
In	O
the	O
field	O
of	O
computer	B-General_Concept
science	I-General_Concept
,	O
an	O
atomic	B-Operating_System
commit	I-Operating_System
is	O
an	O
operation	O
that	O
applies	O
a	O
set	O
of	O
distinct	O
changes	O
as	O
a	O
single	O
operation	O
.	O
</s>
<s>
If	O
the	O
changes	O
are	O
applied	O
,	O
then	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
is	O
said	O
to	O
have	O
succeeded	O
.	O
</s>
<s>
If	O
there	O
is	O
a	O
failure	O
before	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
can	O
be	O
completed	O
,	O
then	O
all	O
of	O
the	O
changes	O
completed	O
in	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
are	O
reversed	O
.	O
</s>
<s>
The	O
other	O
key	O
property	O
of	O
isolation	O
comes	O
from	O
their	O
nature	O
as	O
atomic	B-General_Concept
operations	I-General_Concept
.	O
</s>
<s>
Isolation	O
ensures	O
that	O
only	O
one	O
atomic	B-Operating_System
commit	I-Operating_System
is	O
processed	O
at	O
a	O
time	O
.	O
</s>
<s>
The	O
most	O
common	O
uses	O
of	O
atomic	B-Operating_System
commits	I-Operating_System
are	O
in	O
database	B-Application
systems	I-Application
and	O
version	B-Architecture
control	I-Architecture
systems	I-Architecture
.	O
</s>
<s>
The	O
problem	O
with	O
atomic	B-Operating_System
commits	I-Operating_System
is	O
that	O
they	O
require	O
coordination	O
between	O
multiple	O
systems	O
.	O
</s>
<s>
As	O
databases	B-Application
become	O
more	O
and	O
more	O
distributed	O
,	O
this	O
coordination	O
will	O
increase	O
the	O
difficulty	O
of	O
making	O
truly	O
atomic	B-Operating_System
commits	I-Operating_System
.	O
</s>
<s>
Atomic	B-Operating_System
commits	I-Operating_System
are	O
essential	O
for	O
multi-step	O
updates	O
to	O
data	O
.	O
</s>
<s>
If	O
the	O
entire	O
operation	O
is	O
not	O
completed	O
as	O
one	O
atomic	B-Operating_System
commit	I-Operating_System
,	O
then	O
several	O
problems	O
could	O
occur	O
.	O
</s>
<s>
With	O
atomic	B-Operating_System
commits	I-Operating_System
neither	O
of	O
these	O
cases	O
can	O
happen	O
,	O
in	O
the	O
first	O
case	O
of	O
the	O
system	O
failure	O
,	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
would	O
be	O
rolled	O
back	O
and	O
the	O
money	O
returned	O
to	O
X	O
.	O
</s>
<s>
In	O
the	O
second	O
case	O
,	O
the	O
request	O
of	O
the	O
balance	O
of	O
Y	O
cannot	O
occur	O
until	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
is	O
fully	O
completed	O
.	O
</s>
<s>
Atomic	B-Operating_System
commits	I-Operating_System
in	O
database	B-Application
systems	I-Application
fulfil	O
two	O
of	O
the	O
key	O
properties	O
of	O
ACID	O
,	O
atomicity	B-General_Concept
and	O
consistency	B-General_Concept
.	O
</s>
<s>
Consistency	B-General_Concept
is	O
only	O
achieved	O
if	O
each	O
change	O
in	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
is	O
consistent	O
.	O
</s>
<s>
As	O
shown	O
in	O
the	O
example	O
atomic	B-Operating_System
commits	I-Operating_System
are	O
critical	O
to	O
multistep	O
operations	O
in	O
databases	B-Application
.	O
</s>
<s>
Due	O
to	O
modern	O
hardware	O
design	O
of	O
the	O
physical	B-General_Concept
disk	I-General_Concept
on	O
which	O
the	O
database	O
resides	O
true	O
atomic	B-Operating_System
commits	I-Operating_System
cannot	O
exist	O
.	O
</s>
<s>
This	O
writing	O
limit	O
is	O
why	O
true	O
atomic	B-Operating_System
commits	I-Operating_System
are	O
not	O
possible	O
.	O
</s>
<s>
After	O
the	O
database	O
entries	O
in	O
memory	B-General_Concept
have	O
been	O
modified	O
they	O
are	O
queued	O
up	O
to	O
be	O
written	O
to	O
disk	O
.	O
</s>
<s>
The	O
two-phase	B-General_Concept
commit	I-General_Concept
protocol	I-General_Concept
and	O
three-phase	O
commit	B-Language
protocol	O
attempt	O
to	O
solve	O
this	O
and	O
some	O
of	O
the	O
other	O
problems	O
associated	O
with	O
atomic	B-Operating_System
commits	I-Operating_System
.	O
</s>
<s>
The	O
two-phase	B-General_Concept
commit	I-General_Concept
protocol	I-General_Concept
requires	O
a	O
coordinator	O
to	O
maintain	O
all	O
the	O
information	O
needed	O
to	O
recover	O
the	O
original	O
state	O
of	O
the	O
database	O
if	O
something	O
goes	O
wrong	O
.	O
</s>
<s>
As	O
the	O
name	O
indicates	O
there	O
are	O
two	O
phases	O
,	O
voting	O
and	O
commit	B-Language
.	O
</s>
<s>
During	O
the	O
voting	O
phase	O
each	O
node	O
writes	O
the	O
changes	O
in	O
the	O
atomic	B-Operating_System
commit	I-Operating_System
to	O
its	O
own	O
disk	O
.	O
</s>
<s>
During	O
the	O
commit	B-Language
phase	O
the	O
coordinator	O
sends	O
a	O
commit	B-Language
message	O
to	O
each	O
of	O
the	O
nodes	O
to	O
record	O
in	O
their	O
individual	O
logs	O
.	O
</s>
<s>
The	O
three-phase	O
commit	B-Language
protocol	O
seeks	O
to	O
remove	O
the	O
main	O
problem	O
with	O
the	O
two	B-General_Concept
phase	I-General_Concept
commit	I-General_Concept
protocol	O
,	O
which	O
occurs	O
if	O
a	O
coordinator	O
and	O
another	O
node	O
fail	O
at	O
the	O
same	O
time	O
during	O
the	O
commit	B-Language
phase	O
neither	O
can	O
tell	O
what	O
action	O
should	O
occur	O
.	O
</s>
<s>
The	O
prepare	O
to	O
commit	B-Language
phase	O
occurs	O
after	O
the	O
voting	O
phase	O
and	O
before	O
the	O
commit	B-Language
phase	O
.	O
</s>
<s>
In	O
the	O
voting	O
phase	O
,	O
similar	O
to	O
the	O
two-phase	B-General_Concept
commit	I-General_Concept
,	O
the	O
coordinator	O
requests	O
that	O
each	O
node	O
is	O
ready	O
to	O
commit	B-Language
.	O
</s>
<s>
Upon	O
receiving	O
success	O
messages	O
from	O
each	O
node	O
in	O
the	O
voting	O
phase	O
the	O
prepare	O
to	O
commit	B-Language
phase	O
begins	O
.	O
</s>
<s>
Any	O
node	O
that	O
does	O
not	O
receive	O
a	O
prepare	O
message	O
before	O
the	O
timeout	O
expires	O
aborts	O
the	O
commit	B-Language
.	O
</s>
<s>
After	O
all	O
nodes	O
have	O
replied	O
to	O
the	O
prepare	O
message	O
then	O
the	O
commit	B-Language
phase	O
begins	O
.	O
</s>
<s>
commit	B-Language
message	O
to	O
each	O
node	O
.	O
</s>
<s>
When	O
each	O
node	O
receives	O
this	O
message	O
it	O
performs	O
the	O
actual	O
commit	B-Language
.	O
</s>
<s>
If	O
the	O
commit	B-Language
message	O
does	O
not	O
reach	O
a	O
node	O
due	O
to	O
the	O
message	O
being	O
lost	O
or	O
the	O
coordinator	O
fails	O
they	O
will	O
perform	O
the	O
commit	B-Language
if	O
the	O
timeout	O
expires	O
.	O
</s>
<s>
If	O
the	O
coordinator	O
fails	O
upon	O
recovery	O
it	O
will	O
send	O
a	O
commit	B-Language
message	O
to	O
each	O
node	O
.	O
</s>
<s>
Atomic	B-Operating_System
commits	I-Operating_System
are	O
a	O
common	O
feature	O
of	O
version	B-Architecture
control	I-Architecture
software	I-Architecture
,	O
and	O
crucial	O
for	O
maintaining	O
a	O
consistent	O
state	O
in	O
the	O
repository	O
.	O
</s>
<s>
Most	O
version	B-Architecture
control	I-Architecture
software	I-Architecture
will	O
not	O
apply	O
any	O
part	O
of	O
a	O
commit	B-Language
that	O
fails	O
.	O
</s>
<s>
Notable	O
exceptions	O
are	O
CVS	B-Application
,	O
VSS	B-Protocol
and	O
IBM	B-Protocol
Rational	I-Protocol
ClearCase	I-Protocol
(	O
when	O
in	O
UCM	O
mode	O
)	O
.	O
</s>
<s>
For	O
instance	O
,	O
if	O
version	B-Architecture
control	I-Architecture
software	I-Architecture
encounters	O
a	O
merge	B-Operating_System
conflict	I-Operating_System
that	O
can	O
not	O
be	O
automatically	O
resolved	O
,	O
then	O
no	O
part	O
of	O
the	O
changeset	B-Protocol
is	O
merged	O
.	O
</s>
<s>
Instead	O
,	O
the	O
developer	O
is	O
given	O
an	O
opportunity	O
to	O
either	O
revert	B-General_Concept
their	O
changes	O
or	O
manually	O
resolve	O
the	O
conflict	O
.	O
</s>
<s>
This	O
prevents	O
the	O
entire	O
project	O
from	O
entering	O
a	O
broken	O
state	O
due	O
to	O
a	O
partially	O
applied	O
change	O
set	O
,	O
where	O
one	O
file	O
from	O
a	O
commit	B-Language
is	O
successfully	O
committed	O
,	O
but	O
another	O
file	O
with	O
dependent	O
changes	O
fails	O
.	O
</s>
<s>
Atomic	B-Operating_System
commits	I-Operating_System
may	O
also	O
refer	O
to	O
the	O
ability	O
to	O
simultaneously	O
make	O
changes	O
across	O
multiple	O
projects	O
using	O
version	B-Architecture
control	I-Architecture
software	I-Architecture
in	O
a	O
single	O
operation	O
,	O
using	O
a	O
version	B-Architecture
control	I-Architecture
software	I-Architecture
development	O
strategy	O
known	O
as	O
a	O
monorepo	B-General_Concept
.	O
</s>
<s>
When	O
using	O
a	O
revision	B-Architecture
control	I-Architecture
systems	I-Architecture
a	O
common	O
convention	O
is	O
to	O
use	O
small	O
commits	O
.	O
</s>
<s>
These	O
are	O
sometimes	O
referred	O
to	O
as	O
atomic	B-Operating_System
commits	I-Operating_System
as	O
they	O
(	O
ideally	O
)	O
only	O
affect	O
a	O
single	O
aspect	O
of	O
the	O
system	O
.	O
</s>
<s>
These	O
atomic	B-Operating_System
commits	I-Operating_System
allow	O
for	O
greater	O
understandability	O
,	O
less	O
effort	O
to	O
roll	O
back	O
changes	O
,	O
easier	O
bug	O
identification	O
.	O
</s>
<s>
The	O
greater	O
understandability	O
comes	O
from	O
the	O
small	O
size	O
and	O
focused	O
nature	O
of	O
the	O
commit	B-Language
.	O
</s>
<s>
If	O
only	O
atomic	B-Operating_System
commits	I-Operating_System
are	O
made	O
then	O
commits	O
that	O
introduce	O
errors	O
become	O
much	O
simpler	O
to	O
identify	O
.	O
</s>
<s>
One	O
need	O
not	O
look	O
through	O
every	O
commit	B-Language
to	O
see	O
if	O
it	O
was	O
the	O
cause	O
of	O
the	O
error	O
,	O
only	O
the	O
commits	O
dealing	O
with	O
that	O
functionality	O
need	O
to	O
be	O
examined	O
.	O
</s>
<s>
If	O
the	O
error	O
is	O
to	O
be	O
rolled	O
back	O
,	O
atomic	B-Operating_System
commits	I-Operating_System
again	O
make	O
the	O
job	O
much	O
simpler	O
.	O
</s>
<s>
Instead	O
of	O
having	O
to	O
revert	B-General_Concept
to	O
the	O
offending	O
revision	O
and	O
remove	O
the	O
changes	O
manually	O
before	O
integrating	O
any	O
later	O
changes	O
;	O
the	O
developer	O
can	O
simply	O
revert	B-General_Concept
any	O
changes	O
in	O
the	O
identified	O
commit	B-Language
.	O
</s>
<s>
This	O
also	O
reduces	O
the	O
risk	O
of	O
a	O
developer	O
accidentally	O
removing	O
unrelated	O
changes	O
that	O
happened	O
to	O
be	O
in	O
the	O
same	O
commit	B-Language
.	O
</s>
<s>
Atomic	B-Operating_System
commits	I-Operating_System
also	O
allow	O
bug	O
fixes	O
to	O
be	O
easily	O
reviewed	O
if	O
only	O
a	O
single	O
bug	O
fix	O
is	O
committed	O
at	O
a	O
time	O
.	O
</s>
<s>
This	O
also	O
means	O
that	O
bug	O
fixes	O
can	O
be	O
easily	O
packaged	O
for	O
testing	O
as	O
only	O
the	O
changes	O
that	O
fix	O
the	O
bug	O
are	O
in	O
the	O
commit	B-Language
.	O
</s>
