Write-Ahead Log (WAL) — Concept Check
Questions on Write-Ahead Log (WAL). A write-ahead log records every change to an append-only log on disk before applying it to the main data structure. It guarantees durability and crash recovery in databases, message brokers, and distributed systems.
Questions in this quiz
8 questions on Write-Ahead Log (WAL) — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A database system crashes after writing changes to the WAL but before updating the main data structure. What happens when the system restarts?
- AThe WAL is replayed to recover the changes.
- BThe system performs a full data backup.
- CThe changes are lost permanently.
- DThe system starts with an empty state.
2.In PostgreSQL, which WAL level supports crash recovery and replication but not logical decoding?
- Aminimal
- Breplica
- Cstandard
- Dlogical
3.A database administrator notices that the disk I/O is unusually high. The `vmstat` tool shows frequent writes. What could be causing this?
- AFrequent WAL writes due to high transaction volume.
- BAn increase in read operations.
- CA network issue leading to retries.
- DA memory leak causing excessive paging.
4.A system using WAL crashes before any changes are written to the WAL. What is the outcome?
- AThe system enters an inconsistent state.
- BThe transaction is partially recovered.
- CThe transaction is lost and not committed.
- DThe transaction is automatically retried.
5.Which statement about WAL is true regarding its performance on SSDs?
- AWAL does not benefit from SSDs.
- BSequential writes are significantly faster than random writes.
- CRandom writes are faster than sequential writes.
- DWrite performance is the same for both types.
6.In a distributed system using Raft consensus, what happens after a leader appends a command to its local log?
- AThe leader discards the command if not acknowledged.
- BThe system waits for a client acknowledgment.
- CThe command is replicated to follower nodes.
- DThe command is executed immediately.
7.A developer claims that WAL can replace backups entirely due to its durability. Why is this incorrect?
- AWAL cannot recover from hardware failures.
- BWAL is only for performance optimization.
- CWAL provides durability but not protection against data corruption.
- DWAL files are not stored offsite.
8.In Kafka, what role does the WAL play in the system architecture?
- AWAL in Kafka is used for data encryption.
- BWAL is used only for temporary storage in Kafka.
- CKafka does not use WAL; it relies on in-memory logs.
- DKafka's topics are append-only logs, functioning as a WAL.