Information Technology Reference
In-Depth Information
Cache
Tom = $200
Mike = $100
Cache
Tom = $100
Mike = $200
Nonvolatile
Nonvolatile
Tom = $200
Mike = $100
Tom = $200
Mike = $100
Storage
Storage
Log:
Log:
Tom = $100 Mike = $200
(a) Original state
(b) Updates appended to log
Cache
Cache
Tom = $100
Mike = $200
Tom = $100
Mike = $200
Nonvolatile
Nonvolatile
Tom = $200
Mike = $100
Tom = $100
Mike = $200
Storage
Storage
Log:
Tom = $100 Mike = $200 COMMIT
Log:
Tom = $100 Mike = $200 COMMIT
(c) Commit appended to log
(d) Updates applied
Cache
Tom = $100
Mike = $200
Nonvolatile
Tom = $100
Mike = $200
Storage
Log:
(e) Garbage collect completed transactions from log
Figure14.2: Example transaction with redo logging.
Once the updates are safely in the log, the commit record is appended to the
log (c). This commit record should be written atomically based on the properties
of the underlying hardware (e.g., by making sure it fits on a single disk sector
and putting a strong checksum on it). This step is the atomic commit: prior to
the successful storage of the commit record, a crash would cause the transaction
to roll back; the instant the commit record is persistently stored, the transaction
has committed and is guaranteed to be visible to all reads in the future. Even
if a crash occurs, the recovery process will see the committed transaction in the
log and apply the updates.
Now, the records in persistent storage for Tom and Mike's accounts can be
updated (d).
Finally, once Tom and Mike's accounts are updated, the transaction's records
in the log may be garbage collected (e).
Implementation details. A few specific techniques and observations are im-
portant for providing good performance and reliability for transactions with
 
Search WWH ::




Custom Search