Github user hmcl commented on a diff in the pull request:
https://github.com/apache/storm/pull/1924#discussion_r107455723
--- Diff:
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpoutRetryExponentialBackoff.java
---
@@ -60,17 +61,19 @@ public int compare(RetrySchedule entry1, RetrySchedule
entry2) {
if(result == 0) {
//TreeSet uses compareTo instead of equals() for the Set
contract
//Ensure that we can save two retry schedules with the
same timestamp
- result = entry1.hashCode() - entry2.hashCode();
+ result = entry1.instanceNumber - entry2.instanceNumber;
--- End diff --
I would rather leave this with hasCode() or even as it was initially with
equals(), but hasCode() is OK. This _instanceNumber_ code is very cryptic as
is. Furthermore, this logic is accounting for an hypothetical scenario that
will very unlikely, maybe never, happen, at least in production. Let's keep it
simple. Code readability and simplicity are very important.
Let's revert the whole change in this class.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---