It's to impose the desired iteration ordering. When you re-put a key in a 
LinkedHashSet, it doesn't change its location in the linked list.

In other words, the LHS maintains insertion, not update, order. By removing and 
adding, we get update order instead.

There's a bigger question about whether this is important or not. I was 
thinking it would be nice to re-play the events just as they happened. But the 
buffer keys themselves have a stable total order, which determines the emit 
ordering, so any flush/replay ordering differences should not be observable.

So I think I'll just change it to a regular set. Let me know if you disagree.

[ Full content available at: https://github.com/apache/kafka/pull/5724 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to