30 terms

AdvDB: Concurrency Control

Test 3 Chapter 15 in DB System Concepts

Terms in this set (...)

What is concurrency control as it relates to DBMSs?
When several transactions execute concurrently in the database, the consistency of data may no longer be preserved. It is necessary for the system to control the interaction among the concurrent transactions, and this control is achieved through one of a variety of mechanisms called concurrency-control schemes
What are the four most common concurrency-control schemes?
Locking Protocols
Timestamp Ordering Schemes
Validation Techniques
Multiversion Schemes
What are the two phases in a two-phase locking protocol?
Growing and Shrinking
What is the difference between exclusive and shared locks?
Exclusive Lock - If transaction T has obtained an exclusive lock on item Q, then T can both read and write Q while other transactions cannot use Q
Shared Locks - If transaction T has obtained a shared lock on item Q, then T can read Q but not update Q while other transactions can read Q but they cannot update Q
Describe the Two-Phase Locking Protocol.
Protocol Rules
2 Phases
Guarantees Serializability
Rules of Two-Phase-Locking Protocol
-Before operating on any row, a transaction must acquire a lock on that row
-After releasing a lock, a transaction must never acquire any more locks
2 Phases of Two-Phase-Locking Protocol
- Growing Phase +Transactions may obtain locks but they may not release them
- Shrinking Phase = Transaction may release locks but the may not obtain new ones
Identify two approaches to deadlock handling.
- Ensure that no cyclic waits can occur by ordering the requests for locks, or requiring all locks to be acquired together
- Preemption and Transaction Rollbacks
Describe preemption in respect to deadlock handling
Assign a unique timestamp to each transaction for the system to use in deciding whether the transaction should wait or rollback
If rolled back, it retains its old timestamp
Describe Deadlock Detection and Recovery Scheme
System constructs a wait-for graph, the system is only in a deadlock state if and only if this graph contains a cycle
If a deadlock is detected the system rolls back
What is the difference between a Strict Two-Phase Locking System and a Rigorous Two-Phase Locking System?
- Strict = Transaction must hold all its exclusive locks till it commits/aborts
- Rigorous = Transaction must hold all its locks till commit/abort. In this protocol transactions can be serialized in the order in which they commit
Lock Upgrade
Denotes the conversion from shared to exclusive nodes
Can only take pace during the growing phase of a Two-Phase-Locking Protocol
Lock Downgrade
Denotes the conversion from exclusive to shared nodes
Can only take place during the shrinking phase of a Two-Phase-Locking Protocol
Describe the timestamp ordering scheme, be sure the mention the roles played by W-timestamps and R-timestamps.
Each transaction is issued a unique timestamp when when it enters the system
Protocol manages concurrent execution such that the timestamps determine the serializability order
Protocol maintains two timestamp values for each data Q
W-timestamp(Q) and R-timestamp(Q)
Protocol ensures that any conflicting read and write operations are executed in timestamp order
Protocol ensures freedom from deadlocks as no transaction waits
Schedule may not cascade-free and may not even be recoverable
the largest timestamp of any transaction that executed write(Q) successfully
the largest timestamp of any transaction that executed read(Q) successfully
Describe a multiversion concurrency control scheme.
Multiversion schemes keep old versions of data items to increase concurrency
2 Approaches: Multiversion Timestamp Ordering and Multiversion Two-Phase Locking
Describe Multiversion Timestamp Ordering
Each successful write results in the creation of a new version of the data item written
Use timestamps to label all versions
Describe Multiversion Two-Phase Locking
Differentiates between read-only transactions and update transactions
Describe How Multiversion Two-Phase Locking Deals With "Update" Transactions
-Follow Rigorous 2-Phase Locking
-Transactions acquire read and write locks and hold all locks up to the end of the transaction
-Each successful write results in the creation of a new version of the data item written
-Each version of a data item has a single timestamp whose value is obtained from a counter ts-counter that is incremented during commit processing
Describe How Multiversion Two-Phase Locking Deals With "Read-Only" Transactions
-Follow Multiversion Timestamp Ordering Protocol for performing reads
-Transactions are assigned a timestamp by reading the current value of ts-counter before they start execution
What is snapshot isolation?
A Multiversion concurrency-control protocol based on validation that involves giving a transaction a "snapshot" of the database at the time when it begins its execution. It then operates on that snapshot in complete isolation from concurrent transaction.
What is meant by the term granularity as it relates to concurrency control?
The size of the data item chosen as a unit of protection by a concurrency control protocol
Fine Granularity
Lower in Tree, high concurrency, high locking overhead
Coarse Granularity
Higher in Tree, Low Locking Overhead, Low Concurrency
Explain Explicit and Implicit Locks
-When a transaction locks a node, in either shared or exclusive mode, the transaction also has implicitly locked all the descendants of that node in the same lock mode
-There is no difference in the functionalities of these two locks, the only difference is in the way they are acquired
Explain Intention Locks
-Allow a higher level node to be locked in S or X mode without having to check all descendant nodes
-If a node is locked in an intention mode, explicit locking is done at a lower level of the tree (at a finer granularity).
What are theTimestamp Methods Related to deadlock avoidance
Wait-Die Scheme and Wound-Wait Scheme
Explain the Wait-Die Scheme
-Based on the nonpreemptive technique
-If Ti requests resources currently held by Tj, Ti is allowed to wait only if it has a smaller timestamp than does Tj (Ti is older than Tj). Otherwise, Ti is rolled back (dies)
Explain the Wound-Wait Scheme
-Based on preemptive technique
-If Ti requests a resource currently held by Tj, Ti is allowed to wait only if it has a larger timestamp than does Tj (Ti is younger than Tj). Otherwise, Tj is rolled back (Tj is wounded by Ti).