Follow up to fix producer batch comparator
In comparator, objects that are not equal need to have a stable order otherwise, binary search may not find the objects. Improve the producer batch comparator
@@ -178,7 +178,7 @@ public class TransactionManager {
private static final Comparator<ProducerBatch> PRODUCER_BATCH_COMPARATOR = (b1, b2) -> {
if (b1.baseSequence() < b2.baseSequence()) return -1;
else if (b1.baseSequence() > b2.baseSequence()) return 1;
- else return b1.equals(b2) ? 0 : 1;
+ else return Integer.compare(b1.hashCode(), b2.hashCode());
};
TopicPartitionEntry() {
