Bird
0
0

How does Kafka behave if both retention.ms and retention.bytes are set, but retention.bytes is smaller than the actual data size?

hard📝 Application Q9 of 15
Kafka - Topics and Partitions
How does Kafka behave if both retention.ms and retention.bytes are set, but retention.bytes is smaller than the actual data size?
AKafka deletes messages only when both retention.ms and retention.bytes limits are exceeded
BKafka ignores retention.bytes and deletes messages only after retention.ms expires
CKafka increases retention.ms automatically to avoid data loss
DKafka deletes oldest messages to keep size under retention.bytes regardless of retention.ms
Step-by-Step Solution
Solution:
  1. Step 1: Understand retention policy precedence

    Kafka deletes messages when either retention.ms or retention.bytes limit is reached.
  2. Step 2: Analyze behavior when size limit is smaller

    If retention.bytes is smaller than data size, Kafka deletes oldest messages to keep size under limit.
  3. Final Answer:

    Kafka deletes oldest messages to keep size under retention.bytes regardless of retention.ms -> Option D
  4. Quick Check:

    Either limit triggers deletion = Kafka deletes oldest messages to keep size under retention.bytes regardless of retention.ms [OK]
Quick Trick: Either time or size limit triggers deletion [OK]
Common Mistakes:
  • Thinking both limits must be exceeded
  • Assuming retention.ms overrides retention.bytes
  • Believing Kafka auto-adjusts retention.ms

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes