Extra Credit
Why do you think even with compaction, you can get duplicates?
Click to view the answer...
There are two key aspects to compaction that allow for duplicates:
- The cleanup policy compact guarantees only that at least one message for each key will be available
- Compaction is run periodically. So there will be times when it has not run but multiple versions of a message of the same key might be produced