

























Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!


























Definitions and Basic Concepts
Local Recovery Management
In-place update, out-of-place update
Distributed Reliability Protocols
Two phase commit protocol
Three phase commit protocol
Acknowledgements:
I am indebted to Arturas Mazeika for providing me his slides of this course.
J. Gamper
Reliability
reliable DDBMS
is one that can continue to process user requests even when the
underlying system is unreliable, i.e., failures occur
Failures
-
Transaction failures
System (site) failures, e.g., system crash, power supply failure
Media failures, e.g., hard disk failures
Communication failures, e.g., lost/undeliverable messages
Reliability is closely related to the problem of how to maintain the
atomicity
and
durability
properties of transactions
J. Gamper
Local Recovery Management
The
local recovery manager (LRM)
maintains the atomicity and durability properties of
local transactions at each site.
Architecture
- Volatile
storage: The main memory of the computer system (RAM)
- Stable
storage
A storage that “never” looses its contents
storage) and software (stable-write, stable-read, clean-up) componentsIn reality this can only be approximated by a combination of hardware (non-volatile
J. Gamper
Local Recovery Management...
Two ways for the LRM to deal with update/write operations
- In-place update
Physically changes the value of the data item in the stable database
As a result, previous values are lost
Mostly used in databases
- Out-of-place update
value(s)The new value(s) of updated data item(s) are stored separately from the old
Periodically, the updated values have to be integrated into the stable DB
J. Gamper
In-Place Update...
log
is the most popular structure for recording DB modifications on stable storage
Consists of a sequence of
log records
that record all the update activities in the DB
Each log record describes a significant event during transaction processing
Types of log records
-
i
: if transaction
i
has started
i
j
1
2
: before
i
executes a
j
, where
1
is the old value
before the write and
2
is the new value after the write
i
: if
i
has committed
i
: if
i
has aborted
the DB in case of a failure.With the information in the log file the recovery manager can restore the consistency of
J. Gamper
In-Place Update...
Assume the following situation when a system crash occurs
Upon recovery:
-
All effects of transaction
1
should be reflected in the database (
None of the effects of transaction
2
should be reflected in the database (
J. Gamper
In-Place Update...
UNDO Protocol
-
has startedUNDO’ing an action means to restore the object to its image before the transaction
The UNDO operation uses the log information and restores the old value of the object
J. Gamper
In-Place Update...
Example:
Consider the transactions
0
and
1
0
executes before
1
) and the
following initial values:
, and
0 :
Possible order of actual outputs to the log file and the DB:
Log
DB
0
0
0
0
1
1
1
J. Gamper
In-Place Update...
Logging Interface
Log pages/buffers can be written to stable storage in two ways:
- synchronously
The addition of each log record requires that the log is written to stable storage
supended until the write is completeWhen the log is written synchronoously, the executtion of the transaction is
delay in response time
- asynchronously
Log is moved to stable storage either at periodic intervals or when the buffer fills up.
J. Gamper
In-Place Update...
When to write
log records into stable storage?
Assume a transaction
updates a page
Fortunate case
-
System writes
in stable database
System updates stable log for this update
SYSTEM FAILURE OCCURS!... (before
commits)
We can recover (undo) by restoring
to its old state by using the log
Unfortunate case
-
System writes
in stable database
SYSTEM FAILURE OCCURS!... (before stable log is updated)
valueWe cannot recover from this failure because there is no log record to restore the old
Solution: Write-Ahead Log (WAL) protocol
J. Gamper
Out-of-Place Update
Two out-of-place strategies are shadowing and differential files
Shadowing
-
the new values and write it into the stable databaseWhen an update occurs, don’t change the old page, but create a shadow page with
Update the access paths so that subsequent accesses are to the new shadow page
The old page is retained for recovery
Differential files
-
For each DB file
maintain
a read-only part
a differential file consisting of insertions part (
) and deletions part (
−
Thus,
−
J. Gamper
Distributed Reliability Protocols
and durability of distributed transactionsAs with local reliability protocols, the distributed versions aim to maintain the atomicity
recoveryMost problematic issues in a distributed transaction are commit, termination, and
- Commit protocols
How to execute a commit command for distributed transactions
How to ensure atomicity (and durability)?
- Termination protocols
If a failure occurs at a site, how can the other operational sites deal with it
Non-blocking:
the occurrence of failures should not force the sites to wait until the
failure is repaired to terminate the transaction
- Recovery protocols
When a failure occurs, how do the sites where the failure occurred deal with it
Independent:
a failed site can determine the outcome of a transaction without
having to obtain remote information
J. Gamper
Centralized Two Phase Commit Protocol (2PC)
Very simple protocol that ensures the atomic commitment of distributed transactions.
Phase 1:
The coordinator gets the participants ready to write the results into the
database
Phase 2:
Everybody writes the results into the database
Global Commit Rule
-
abort itThe coordinator aborts a transaction if and only if at least one participant votes to
commit itThe coordinator commits a transaction if and only if all of the participants vote to
Centralized
since communication is only between coordinator and the participants
J. Gamper
Centralized Two Phase Commit Protocol (2PC)...
J. Gamper