You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/02/22 09:00:43 UTC

[GitHub] [ozone] Xushaohong commented on a change in pull request #3121: HDDS-6357. Fix EpochEntry compareTo logic

Xushaohong commented on a change in pull request #3121:
URL: https://github.com/apache/ozone/pull/3121#discussion_r811714402



##########
File path: hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/EpochEntry.java
##########
@@ -64,6 +64,9 @@ public int hashCode() {
   @Override
   public int compareTo(Object o) {
     if (this.epoch == ((EpochEntry<?>)o).epoch) {
+      if (this.cachekey != ((EpochEntry<?>)o).cachekey) {
+        return -1;

Review comment:
       > > The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y.
   > 
   > In other words, we cannot return -1 unconditionally in this case.
   
   yep, I use hashcode to compare now.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org