Study resource

Read at your pace, then save it for later.

Unit 11: Database Recovery Systems Assessment

Section A — 1 Mark Questions

1. Define a transaction failure. [1 Mark]

Answer: A transaction failure occurs when a specific transaction cannot complete due to internal errors like logical errors or system-level constraints.

2. What is the primary purpose of log-based recovery? [1 Mark]

Answer: Its purpose is to ensure atomicity and durability by recording all database updates on stable storage.

3. What does atomicity guarantee in a transaction? [1 Mark]

Answer: Atomicity guarantees that either all operations of a transaction are executed or none of them are.

4. Define non-volatile storage. [1 Mark]

Answer: It is storage media that retains information even after a power failure, such as magnetic disks.

5. What is the role of a 'checkpoint' in recovery? [1 Mark]

Answer: A checkpoint limits the amount of log that needs to be scanned during recovery.

6. Name one type of system failure. [1 Mark]

Answer: A power failure or system crash.

7. What is a buffer? [1 Mark]

Answer: It is a temporary storage area in main memory used to hold data blocks before they are written to disk.

8. What does the 'undo' operation in recovery achieve? [1 Mark]

Answer: It reverses the effects of an incomplete transaction to maintain consistency.

9. Define the term 'volatile storage'. [1 Mark]

Answer: Storage that loses its contents when power is lost, such as main memory.

10. What is a media failure? [1 Mark]

11. Define the 'redo' operation. [1 Mark]

Answer: The redo operation reapplies updates of committed transactions from the log to the database.

12. What is a write-ahead log? [1 Mark]

Answer: It is a protocol requiring log records to be written to stable storage before the actual data is updated on disk.

13. List one cause of logical error. [1 Mark]

Answer: A programming error or invalid input that leads to transaction failure.

14. What is meant by stable storage? [1 Mark]

Answer: Storage that is immune to almost all types of failures, typically implemented through redundant disks.

15. What is an abort? [1 Mark]

Answer: The intentional termination of a transaction due to error or conflict.

16. What does recovery management handle? [1 Mark]

Answer: It restores the database to a consistent state after a crash.

17. What is the significance of the Log sequence number? [1 Mark]

Answer: It uniquely identifies log records to maintain the order of operations.

18. What happens during a system crash? [1 Mark]

Answer: The database stops, and data in volatile memory is lost.

19. What is meant by force-writing? [1 Mark]

Answer: Writing a buffer block immediately to disk.

20. Why is buffer management critical for recovery? [1 Mark]

Answer: It dictates when modified data is flushed from memory to disk, directly impacting recovery requirements.

Section B — 2/3 Mark Questions

1. Differentiate between volatile and non-volatile storage. [2 Marks]

Answer: Volatile storage (like RAM) loses data when power is cut and is used for fast access. Non-volatile storage (like disk) persists after a crash and is used for long-term data storage.

2. Explain the concept of Atomicity in the context of recovery. [2 Marks]

Answer: Atomicity is the 'all or nothing' property. Recovery ensures that if a transaction fails halfway, the system rolls back all partial changes, ensuring the database state remains as if the transaction never started.

3. What are the two types of log-based recovery operations? [2 Marks]

Answer: The two operations are Undo and Redo. Undo removes changes made by incomplete transactions, while Redo reapplies changes from committed transactions that were not yet saved to disk.

4. Explain the Write-Ahead Log (WAL) protocol. [3 Marks]

Answer: The WAL protocol mandates that all log records must be written to stable storage before the corresponding data is updated on the physical disk. This ensures that in the event of a crash, the recovery manager can reconstruct the exact state of the database by reading the logs.

5. List three types of database failures. [3 Marks]

Answer: 1. Transaction failure (internal errors), 2. System crash (hardware/software failure causing memory loss), 3. Media failure (disk head crash or storage damage).

6. Describe the role of a checkpoint. [2 Marks]

Answer: A checkpoint marks a point in time where all modified data is synchronized with the disk. This allows the system to skip processing the entire log and start recovery from the last checkpoint.

7. How does buffer management affect the need for recovery? [3 Marks]

Answer: Buffer management determines whether updates are written immediately or delayed. If the buffer manager delays writes, the system requires a robust redo log to ensure committed data is not lost during a crash, effectively acting as a bridge between memory and stable storage.

8. What is the consequence of a failure in non-volatile storage? [2 Marks]

Answer: Failure of non-volatile storage is critical as it leads to data loss on the disk itself, necessitating a restore from a backup or redundant copy.

9. Define a concurrent transaction in recovery. [2 Marks]

Answer: A concurrent transaction refers to multiple transactions executing simultaneously; the recovery manager must be able to isolate the effects of each during log processing.

10. Why is transaction logging necessary? [3 Marks]

Answer: Logging is necessary to maintain an audit trail of every change. It allows the database to backtrack to a consistent state (Undo) or recover committed work that was lost from volatile memory (Redo).

Section C — 5 Mark Questions

1. Explain the complete process of Log-based Recovery after a system crash. [5 Marks]

Answer:

Introduction

Log-based recovery is the primary method for ensuring database consistency following a crash.

Process Steps

  • Analysis Phase: The system scans the log to identify which transactions were in progress and which were committed at the time of the crash.
  • Redo Phase: The recovery manager replays all committed transactions from the log to ensure their changes are reflected in the database.
  • Undo Phase: The manager reverses the changes made by transactions that were active (uncommitted) at the time of the crash.

Key Considerations

The system uses the Write-Ahead Log protocol to guarantee that logs reach stable storage before data pages. By following these steps, the recovery manager ensures that only complete, valid transactions are saved, and incomplete ones are removed, maintaining atomicity.

2. Discuss the classification of database failures and their impact on data integrity. [5 Marks]

Answer:

Introduction

Failures are classified based on the level of the system affected and the severity of the impact on stored data.

Failure Categories

  • Transaction Failure: Logical errors or system-detected errors where a specific transaction cannot complete. These usually require simple rollbacks.
  • System Crash: A failure that causes the loss of volatile memory (RAM), but non-volatile storage (disk) remains intact. This is the most common scenario requiring log-based recovery.
  • Media Failure: A physical failure of the storage device. This is the most severe, often requiring restoration from backups or RAID systems.

Impact

Each failure type requires a specific strategy. Transaction failures target individual atomicity, while crashes require global database consistency restoration. Media failure forces a total recovery process, highlighting the importance of redundant storage strategies.

3. Explain the role of the Buffer Manager in database recovery. [5 Marks]

Answer:

Introduction

The buffer manager acts as a cache between the disk and the database engine, significantly impacting recovery performance and complexity.

Functional Roles

  • Page Fetching: It loads data from disk to memory, minimizing expensive I/O operations.
  • Flushing Policies: It decides when to write updated pages from memory to disk. If it flushes too often, performance drops; if too infrequently, the risk of data loss during a crash increases.
  • Recovery Integration: The buffer manager must coordinate with the recovery manager to ensure the log records are flushed before the modified data pages are written to disk (The Force-Write concept).

Conclusion

Efficient buffer management reduces the duration of recovery processes by maintaining up-to-date checkpoints, ensuring that the gap between memory state and disk state is manageable during restart.

4. Describe the concept of Atomicity and Durability in the recovery context. [5 Marks]

Answer:

Introduction

Atomicity and Durability are two core ACID properties that rely entirely on the recovery system to be upheld.

Atomicity Explanation

Atomicity ensures 'All or Nothing'. If a transaction is interrupted by a crash, the recovery system uses the log to ensure no partial changes remain in the database. This is achieved by rolling back any uncommitted work.

Durability Explanation

Durability guarantees that once a transaction is committed, its changes survive subsequent failures. The recovery system ensures this by utilizing the log to 'Redo' operations that may have been committed in memory but were not yet physically written to the disk when the crash occurred.

Application

Both properties are achieved by maintaining a sequential log of operations on stable storage, which serves as the ultimate source of truth when the system attempts to reconstruct the state after a failure.

5. Discuss the challenges and mechanisms of handling failures in a concurrent transaction environment. [5 Marks]

Answer:

Introduction

In a concurrent environment, multiple transactions overlap, making recovery complex because the log contains interleaved records from different sessions.

Challenges

  • Interleaved Logging: Because many transactions write to the log at the same time, the recovery manager must correctly group logs by transaction ID.
  • Dependencies: One transaction might depend on the data updated by another concurrent transaction, complicating the undo process.

Mechanisms

  • Transaction Identifiers: Each log record is tagged with an ID to ensure that when a crash occurs, the recovery manager can accurately isolate the changes belonging to each failed transaction.
  • Sequence Numbering: Log sequence numbers (LSN) are used to maintain a chronological timeline of events, allowing the system to reconstruct the correct state regardless of transaction concurrency.

By effectively tracking each transaction independently, the system ensures that rolling back a single failed transaction does not accidentally destroy the work of another concurrently executing transaction.


xxx

Did this help you understand better?

Your feedback improves the quality of this resource for everyone.