Bird
Raised Fist0

You set cleanup.policy=compact on a topic but notice old messages are not removed. What is a likely cause?

medium📝 Debug Q14 of Q15
Kafka - Monitoring and Operations
You set cleanup.policy=compact on a topic but notice old messages are not removed. What is a likely cause?
AThe topic has no keys in messages
BThe retention.ms is set to 0
CThe broker is running in debug mode
DThe topic has too many partitions
Step-by-Step Solution
Solution:
  1. Step 1: Understand log compaction requirement

    Log compaction requires messages to have keys to identify duplicates.
  2. Step 2: Analyze why old messages remain

    If messages lack keys, compaction cannot remove duplicates, so old messages stay.
  3. Final Answer:

    The topic has no keys in messages -> Option A
  4. Quick Check:

    Compaction needs keys to remove old messages [OK]
Quick Trick: Compaction needs keys; no keys means no compaction [OK]
Common Mistakes:
MISTAKES
  • Assuming retention.ms=0 disables compaction
  • Blaming debug mode for compaction issues
  • Thinking partition count affects compaction directly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes