Rollback =
undoall
the updates performed
by a
transaction
Cascading rollback
Important fact:
If a
transaction T1writes
a DB element A
(and transaction T1
has not committed)
and
later the
transaction T2reads the
valuewritten by
transaction T1,
then:
The
validity of the
valueread by
transaction T2 will
depend
on
whether transaction T1
will commit
Cascading rollback:
Iftransaction T1
has read (used)dirty datawritten by
the
uncommitted transaction
T2,
then:
Whentransaction T1aborts, then:
We must alsoaborttransaction T2 !!!
Cascading rollbackprocedure:
T = the transaction that has aborted
RollBack( T )
{
Undo the updates performed by transaction T;
// This depends on the logging method
// See below...
Let S = set of transactions that has read (dirty) data from T
for ( each Ti ∈ S ) do
{
Abort( Ti );
RollBack( Ti ); // This will abort and rollback
// ALL transactions that have read
// from T indirectly
}
}
How to rollback a transaction
Fact:
The rollback procedure
is different for
different logging methods !!!
Rollback
an update
when using an undolog:
In undo logging, we
write a
undo log record when
we update the
database element:
The dirty data can be
found in these
places:
Dirty data can be
stored:
In memory buffer
On disk
Rollback procedure:
Find all the
updated values by an
aborted transaction T
in the undo log
Use the
(old) value in the
undo log
to:
Restore the
value of the
database element
on diskand in
the memory buffer
Rollback
an update
when using a redolog:
In redo logging, we
will
only perform an
OUTPUT operation
(and
update the
database element on
disk)
when the
transaction
has
committed:
The dirty data can be
found in these
places:
Dirty data can be
stored:
In memory buffer
Rollback procedure:
Find all the
updated values by an
aborted transaction T
in the redo log
Use the
value in the
database elementstored on disk to:
Restore the
value of the
database element
in
the memory buffer
Rollback
an update
when using an undo/redolog:
In undo/redo logging, we
write a
undo log record when
we update the
database element:
The dirty data can be
found in these
places:
Dirty data can be
stored:
In memory buffer
On disk
Rollback procedure:
Find all the
updated values by an
aborted transaction T
in the undo/redo log
Use the
(old) value in the
undo/redo log
to:
Restore the
value of the
database element
on diskand in
the memory buffer