Surviving a crash — OS, DBMS & Networks Aptitude Question
Surviving a crash: A transaction commits and the server loses power a second later. Answer and worked solution on CodeKairo.
- Topic: OS, DBMS & Networks
- Section: Programming MCQs
- Difficulty: Easy
- Time target: 60 seconds
Question
A transaction commits and the server loses power a second later. Which ACID property guarantees the committed changes are still present when the database restarts?
Options
- Atomicity
- Consistency
- Durability
- Isolation
Show the answer and the worked solution
Correct answer: C. Durability
Worked solution
- Atomicity guarantees a transaction is all or nothing, and isolation guarantees concurrent transactions do not see one another's intermediate state.
- Consistency guarantees a transaction moves the database from one valid state to another.
- Surviving a crash after a commit is exactly the promise of Durability, normally kept by forcing the log to stable storage before the commit is acknowledged.
Answer: Durability.
The idea
Map each ACID letter to the failure it defends against: atomicity against a mid-transaction abort, isolation against concurrency, durability against a crash.
Shortcut. Atomicity and isolation govern work still in progress and consistency governs valid states; only durability speaks about changes after the commit, which is when the power fails here.
Common trap. "Atomicity" is linked with crash recovery, but it concerns undoing uncommitted work as all or nothing, not keeping committed work.