Challenge - 5 Problems
Kafka Log Compaction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of the Kafka log compaction status check?
Given the following Kafka topic configuration and status check command, what will be the output?
Kafka
kafka-topics.sh --describe --topic user-updates --bootstrap-server localhost:9092 Topic: user-updates PartitionCount: 3 ReplicationFactor: 2 Configs: cleanup.policy=compact Topic: user-updates Partition: 0 Leader: 1 Replicas: 1,2 Isr: 1,2 Topic: user-updates Partition: 1 Leader: 2 Replicas: 2,3 Isr: 2,3 Topic: user-updates Partition: 2 Leader: 3 Replicas: 3,1 Isr: 3,1
Attempts:
2 left
💡 Hint
Look for the cleanup.policy configuration in the topic description.
✗ Incorrect
The output shows 'cleanup.policy=compact' which means log compaction is enabled. The topic has 3 partitions and replication factor 2 as shown.
🧠 Conceptual
intermediate1:30remaining
What does Kafka log compaction guarantee?
Choose the correct statement about Kafka log compaction guarantees.
Attempts:
2 left
💡 Hint
Think about what happens to messages with the same key after compaction.
✗ Incorrect
Log compaction keeps the latest message for each key, removing older duplicates, but does not delete messages based on time or compress data.
❓ Predict Output
advanced1:30remaining
What error occurs when enabling log compaction with invalid cleanup.policy?
What error will Kafka produce if you set cleanup.policy=compacted instead of compact for a topic?
Kafka
kafka-topics.sh --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 --config cleanup.policy=compacted
Attempts:
2 left
💡 Hint
Check the exact allowed values for cleanup.policy.
✗ Incorrect
Kafka only accepts 'compact', 'delete', or both combined. 'compacted' is invalid and causes an error.
🚀 Application
advanced1:30remaining
How to configure a topic for both log compaction and time-based deletion?
Which configuration correctly enables both log compaction and time-based deletion on a Kafka topic?
Attempts:
2 left
💡 Hint
Multiple policies are comma-separated in Kafka configs.
✗ Incorrect
Kafka expects multiple cleanup policies separated by commas without spaces.
🧠 Conceptual
expert2:00remaining
Why might Kafka log compaction not immediately remove old records?
Select the best explanation why Kafka log compaction does not instantly delete old records after a new record with the same key is written.
Attempts:
2 left
💡 Hint
Think about how Kafka manages background tasks.
✗ Incorrect
Kafka log compaction is a background process that runs periodically, so old duplicates remain until compaction runs.