<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
write-ahead	B-Algorithm
logging	I-Algorithm
(	O
WAL	O
)	O
is	O
a	O
family	O
of	O
techniques	O
for	O
providing	O
atomicity	B-General_Concept
and	O
durability	B-General_Concept
(	O
two	O
of	O
the	O
ACID	O
properties	O
)	O
in	O
database	B-Application
systems	I-Application
.	O
</s>
<s>
A	O
write	B-Algorithm
ahead	I-Algorithm
log	I-Algorithm
is	O
an	O
append-only	O
auxiliary	O
disk-resident	O
structure	O
used	O
for	O
crash	O
and	O
transaction	O
recovery	O
.	O
</s>
<s>
The	O
changes	O
are	O
first	O
recorded	O
in	O
the	O
log	B-General_Concept
,	O
which	O
must	O
be	O
written	O
to	O
stable	B-General_Concept
storage	I-General_Concept
,	O
before	O
the	O
changes	O
are	O
written	O
to	O
the	O
database	O
.	O
</s>
<s>
The	O
main	O
functionality	O
of	O
a	O
write-ahead	B-Algorithm
log	I-Algorithm
can	O
be	O
summarized	O
as	O
:	O
</s>
<s>
Allow	O
the	O
page	O
cache	O
to	O
buffer	O
updates	O
to	O
disk-resident	O
pages	O
while	O
ensuring	O
durability	B-General_Concept
semantics	O
in	O
the	O
larger	O
context	O
of	O
a	O
database	B-Application
system	I-Application
.	O
</s>
<s>
Allow	O
lost	O
in-memory	O
changes	O
to	O
be	O
reconstructed	O
from	O
the	O
operation	O
log	B-General_Concept
in	O
case	O
of	O
a	O
crash	O
.	O
</s>
<s>
In	O
a	O
system	O
using	O
WAL	O
,	O
all	O
modifications	O
are	O
written	O
to	O
a	O
log	B-General_Concept
before	O
they	O
are	O
applied	O
.	O
</s>
<s>
Usually	O
both	O
redo	O
and	O
undo	O
information	O
is	O
stored	O
in	O
the	O
log	B-General_Concept
.	O
</s>
<s>
If	O
a	O
write-ahead	B-Algorithm
log	I-Algorithm
is	O
used	O
,	O
the	O
program	O
can	O
check	O
this	O
log	B-General_Concept
and	O
compare	O
what	O
it	O
was	O
supposed	O
to	O
be	O
doing	O
when	O
it	O
unexpectedly	O
lost	O
power	O
to	O
what	O
was	O
actually	O
done	O
.	O
</s>
<s>
After	O
a	O
certain	O
amount	O
of	O
operations	O
,	O
the	O
program	O
should	O
perform	O
a	O
checkpoint	B-General_Concept
,	O
writing	O
all	O
the	O
changes	O
specified	O
in	O
the	O
WAL	O
to	O
the	O
database	O
and	O
clearing	O
the	O
log	B-General_Concept
.	O
</s>
<s>
WAL	O
allows	O
updates	O
of	O
a	O
database	O
to	O
be	O
done	O
in-place	B-Algorithm
.	O
</s>
<s>
Another	O
way	O
to	O
implement	O
atomic	B-General_Concept
updates	I-General_Concept
is	O
with	O
shadow	B-Application
paging	I-Application
,	O
which	O
is	O
not	O
in-place	B-Algorithm
.	O
</s>
<s>
The	O
main	O
advantage	O
of	O
doing	O
updates	O
in-place	B-Algorithm
is	O
that	O
it	O
reduces	O
the	O
need	O
to	O
modify	O
indexes	O
and	O
block	O
lists	O
.	O
</s>
<s>
ARIES	B-Algorithm
is	O
a	O
popular	O
algorithm	O
in	O
the	O
WAL	O
family	O
.	O
</s>
<s>
Modern	O
file	B-Application
systems	I-Application
typically	O
use	O
a	O
variant	O
of	O
WAL	O
for	O
at	O
least	O
file	B-Application
system	I-Application
metadata	O
;	O
this	O
is	O
called	O
journaling	B-Application
.	O
</s>
