Database Management System (DBMS) / Implementation of atomicity and durability

Shadow Copy Scheme

In the Shadow Copy Scheme, when a transaction updates data, it does not overwrite the original data immediately. Instead, it writes a shadow copy (a duplicate) of the data. The original data remains untouched until the transaction is completed successfully.


🔧 How It Works (Step-by-Step):

  1. Start Transaction

    • The system creates a shadow copy of the data that needs to be changed.

  2. Make Updates to Shadow Copy

    • All changes are applied to the shadow copy, not the original.

  3. Commit Transaction

    • If the transaction succeeds, the system swaps the original copy with the updated shadow copy.

  4. Abort Transaction

    • If the transaction fails, the shadow copy is discarded and the original remains unchanged.



✅ Advantages:

  • Atomicity: Either all changes are made, or none are.

  • Durability: Once committed, changes persist even after a crash.

  • No Need for Undo: Since original data is never overwritten until commit.


❌ Disadvantages:

  • High Storage Use: Requires extra space to store shadow copies.

  • Slow with Large Data: Copying large data structures can be inefficient.

  • Not Suitable for High-Concurrency Systems: Locks entire data blocks during transactions.


📘 Usage:

  • File Systems: Windows uses "Volume Shadow Copy" to back up files without interrupting the use of the system.

  • Databases: Simple DBMS or log-based systems may use this scheme for transaction safety.


🧠 Summary:

Feature

Description

Safe Updates

Modifies data in shadow, not original

Crash Recovery

Easy, just use original if transaction fails

Performance

Slower, more storage needed