advanced~2h
Log Compaction
Understand the alternative to time- and size-based retention: a cleanup policy that keeps only the latest record per key forever, purpose-built for changelog-style topics.
Learning objectives
- Beginner: Explain what problem log compaction solves that time-based and size-based retention cannot.
- Beginner: State the one-sentence rule a compacted topic enforces — keep only the latest record per key.
- Intermediate: Describe how the log cleaner process identifies and removes superseded records, and what a tombstone record does.
- Intermediate: Decide, for a given topic's use case, whether it should use delete, compact, or compact,delete cleanup policy.
- Advanced: Reason about why a compacted topic can still temporarily contain duplicate keys, and why consumers must be written to tolerate that.
- Advanced: Explain the relationship between a compacted topic and a Kafka Streams KTable's changelog topic.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.
Log Compaction