Differences between concurrency control and recovery in terms of
the purposes,algorithms and problems are as follows:
|
Concurrency Control
|
Recovery
|
Purpose
|
- There are multiple transactions happening over a single shared
database which might lead to integrity & consistency problems.
To avoid such problems with the shared database, we use concurrency
control.
- The purpose is to make every individual user feel the
consistency of the system even though it is been used by multiple
user at the same time.
- To ensure serializability
- To apply isolation using mutual exclusion between conflicting
transactions.
|
- Recovery process is needed by the systems to recover from the
unforeseen failures if any. i.e to make the system fault
tolerant.
- The purpose here is to undo the changes done by
aborted/incomplete transactions and only consider the transactions
that have been committed/completed successfully.
- The purpose is coping with all kinds of failure-transaction,
system or media
|
Algorithms
|
- Lock based
- Graph based
- Timestamp based
- Validation based
- Multiversion schemes
|
- STEAL and NO-FORCE policy
- Logging
- Write Ahead Logging (WAL)
|
Problems
|
- Updates might be lost if multiple transactions select same rows
and try to update it.
- Dirty reads can take place.
- Second transaction might try to access the same row multiple
times with different value each time.
|
- Backups are needed to recover from media failure which is time
consuming and requires down time.
- Backup frequency should be decided carefully.
- If transaction log itself are damaged then restoring the
database from the last backup becomes impossible.
|