Concurrency Flashcards
What is a transaction?
Transaction: a logical unit of database processing that includes one or more access operations (read/retrieval, write/update, delete).
What is the lost update problem?
If two transactions are running at the same time and access same variable X, If T1 updates X but T2 reads it before T1 writes update then T1’s update is lost.
What is the Temporary Update problem?
A transaction working with uncommited changes
If T1 crashes and needs to be rolled back, T2 has made a dirty read and cannot be rolled back.
What is the Unrepeatable Read problem?
This happens when a transaction reads two different values for a single variable in the same transaction.
T2 modified it and commited before first and second read in T1.
What is the Incorrect Summary Problem?
When a transaction is performing an aggregate function on a set of values and another transaction is making alterations to those values at the same time.
What is the Phantom Read problem?
A phantom read is similar to both an
incorrect summary and an unrepeatable
read.
What is a commit point in terms of recovery
A transaction reaches its commit point if:
○ It finishes successfully
○ All effects are recorded in the log.
It is then considered permanantly stored in the DB.
Entry is recorded in the log.
What is stored in system log?
start_transaction, T
write_item, T, X, old_value, new_value
read_item, T, X
commit, T
Describe serializability
Serializability is the classical concurrency scheme.
It ensures that a schedule for executing concurrent transactions is equivalent to one that executes the transactions serially in some order.
➢ A serial schedule is a schedule such that there is no interleaving of the operations of the transactions.
➢ If a schedule is serial we can guarantee that no lost updates, incorrect summary problems etc, will arise.
Describe Conflict serializablity
We say that there is a conflict between two transactions T1 and T2 if they contain operations that conflict with each other.
A schedule S is said to be conflict serializable if the conflicting operations occur in exactly the same order as some serial schedule.