0% found this document useful (0 votes)
51 views8 pages

Session 34-DataCache&Recovery

Data items to be modified are first stored in the database cache by the Cache Manager and later flushed to disk. The flushing is controlled by modified and pin-unpin bits. The modified bit indicates if an item has changed, while the pin-unpin bit instructs the OS not to flush an item. The database cache stores disk blocks containing data items accessed by transactions. A cache table tracks which blocks are in cache along with their addresses and status bits. Write-ahead logging ensures transaction atomicity and durability by writing log records to disk before modifying data or committing transactions.

Uploaded by

Parinika Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views8 pages

Session 34-DataCache&Recovery

Data items to be modified are first stored in the database cache by the Cache Manager and later flushed to disk. The flushing is controlled by modified and pin-unpin bits. The modified bit indicates if an item has changed, while the pin-unpin bit instructs the OS not to flush an item. The database cache stores disk blocks containing data items accessed by transactions. A cache table tracks which blocks are in cache along with their addresses and status bits. Write-ahead logging ensures transaction atomicity and durability by writing log records to disk before modifying data or committing transactions.

Uploaded by

Parinika Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Session 34

Catching of Disk Blocks


Data Caching
– Data items to be modified are first stored into
database cache by the Cache Manager (CM) and
after modification they are flushed (written) to the
disk.
– The flushing is controlled by Modified and Pin-
Unpin bits.
• Pin-Unpin: Instructs the operating system not to flush
the data item.
• Modified: Indicates the AFIM of the data item.
Data Cache
Database Cache: A set of main memory buffers; each
buffer typically holds contents of one disk block. Stores the
disk blocks that contain the data items being read and
written by the database transactions.
Data Item Address: (disk block address, offset, size in
bytes).
Cache Table:Table of entries of the form (buffer addr, disk
block addr, modified bit, pin/unpin bit, ...) to indicate which
disk blocks are currently in the cache buffers.
Data items to be modified are first copied into database
cache by the Cache Manager (CM) and after modification
they are flushed (written) back to the disk. The flushing is
controlled by Modified and Pin-Unpin bits.
Pin-Unpin: If a buffer is pinned, it cannot be written back to
disk until it is unpinned.
Modified: Indicates that one or more data items in the
buffer have been changed.
Data Update
• Immediate Update: A data item modified in cache can
be written back to disk before the transaction commits.
• Deferred Update: A modified data item in the cache
cannot be written back to disk till after the transaction
commits (buffer is pinned).

• Shadow update: The modified version of a data item


does not overwrite its disk copy but is written at a
separate disk location (new version).
• In-place update: The disk version of the data item is
overwritten by the cache version.
UNDO and REDO Recovery Actions
To maintain atomicity and durability, some transaction’s may
have their operations redone or undone during recovery. UNDO
(roll-back) is needed for transactions that are not committed yet.
REDO (roll-forward) is needed for committed transactions whose
writes may have not yet been flushed from cache to disk.
Undo: Restore all BFIMs from log to database on disk.
UNDO proceeds backward in log (from most recent to
oldest UNDO).
Redo: Restore all AFIMs from log to database on disk.
REDO proceeds forward in log (from oldest to most recent
REDO).
Write-Ahead Logging Protocol
The information needed for recovery must be written to
the log file on disk before changes are made to the
database on disk. Write-Ahead Logging (WAL) protocol
consists of two rules:
For Undo: Before a data item’s AFIM is flushed to the
database on disk (overwriting the BFIM) its BFIM must be
written to the log and the log must be saved to disk.
For Redo: Before a transaction executes its commit
operation, all its AFIMs must be written to the log and the
log must be saved on a stable store.
References
❑Database System Concepts, Sixth Edition, Abraham
Silberschatz, Yale University
❑ Henry, F.Korth Lehigh University, S. Sudarshan Indian
Institute of Technology,
❑ Bombay.
❑Fundamentals of Database Systems, 7th Edition, Ramez
Elmasri,
❑ University of Texas at Arlington, Shamkant B. Navathe,
University ofTexas at Arlington.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy