13 Transaction Processing Flashcards
(33 cards)
What can a data item refer to?
A field (e.g., name/ID), a record (row), or a block (chunk of data on disk).
What are the steps of a read(X)
operation?
- Find the disk block with X
- Copy the block into RAM
- Copy X from RAM to a program variable
What are the steps of a write(X)
operation?
- Find the disk block with X
- Load block into RAM
- Update X in RAM
- Write the updated block back to disk
What is a transaction?
A group of operations executed together to read and/or update the database.
What is the Atomicity property in ACID?
All steps of a transaction must happen or none at all.
What is the Durability property in ACID?
Once a transaction is complete, its changes must be permanent.
What is the Consistency property in ACID?
A transaction must take the DB from one valid state to another.
What is the Isolation property in ACID?
A transaction’s changes should not be visible to others until it is done.
What are the 5 states of a transaction?
- Active
- Partially Committed
- Committed
- Failed
- Aborted
What does the recovery manager track?
Start, termination, commit, abort, and logs for undo/redo.
What does the UNDO
operation do?
Reverses changes of a failed transaction before commit.
What does the REDO
operation do?
Reapplies changes of a committed transaction after a crash.
What is the shadow-database scheme used for?
To ensure atomicity and durability by applying changes to a copy first.
What are the 4 steps of the shadow-database scheme?
- Apply updates to shadow copy
- Flush shadow copy to disk
- Update pointer to shadow copy
- Delete old DB (commit)
Does the shadow-database scheme support concurrency?
No, only one transaction at a time.
Why are concurrent transactions useful?
Better resource use and faster response time.
What is a schedule in transactions?
The order in which operations from multiple transactions are run.
What is a serial schedule?
Transactions run one after another, without interleaving.
What is a serializable schedule?
A schedule that has the same result as some serial schedule.
What is conflict serializability?
If we can swap non-conflicting operations to make the schedule serial.
When do two operations conflict?
They access the same item and at least one is a write.
What is view serializability?
Same reads/writes and final write as some serial schedule.
How do we check conflict serializability?
Build a precedence graph. If it has no cycles, it’s conflict serializable.