Recall & Review
beginner
What is log compaction in Kafka?
Log compaction is a Kafka feature that retains only the latest value for each key in a topic, removing older duplicates to save storage and ensure data freshness.
Click to reveal answer
beginner
How does Kafka decide which messages to keep during log compaction?
Kafka keeps the latest message for each unique key and removes older messages with the same key during log compaction.
Click to reveal answer
intermediate
What is the difference between log compaction and log retention by time?
Log retention by time deletes messages older than a set time, while log compaction keeps the latest message per key regardless of age.
Click to reveal answer
intermediate
Why is log compaction useful in Kafka?
It helps keep topics small by removing outdated data, supports stateful stream processing, and ensures consumers can recover the latest state efficiently.
Click to reveal answer
advanced
What happens if a message with a key is sent with a null value in a compacted topic?
A message with a null value acts as a delete marker (tombstone) for that key, so the key and its data are removed during compaction.
Click to reveal answer
What does Kafka's log compaction keep for each key?
✗ Incorrect
Log compaction keeps only the latest message for each unique key.
What is the purpose of a tombstone message in a compacted topic?
✗ Incorrect
A tombstone message has a null value and marks the key for deletion during compaction.
Which scenario best fits using log compaction?
✗ Incorrect
Log compaction is ideal for keeping the latest state like user profiles.
How does log compaction affect topic size?
✗ Incorrect
Log compaction removes older duplicates, reducing topic size.
Can log compaction remove messages with unique keys that have never been duplicated?
✗ Incorrect
Messages with null values act as tombstones and are removed during compaction.
Explain how Kafka's log compaction works and why it is useful.
Think about how Kafka keeps only the freshest data for each key.
You got /4 concepts.
Describe the role of tombstone messages in log compaction.
Consider how Kafka deletes keys using special messages.
You got /4 concepts.