You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/12/02 03:15:26 UTC

[1/4] hbase git commit: HBASE-19406 Fix CompactionRequest equals and hashCode

Repository: hbase
Updated Branches:
  refs/heads/branch-1 68ee26d34 -> d2a54c98b
  refs/heads/branch-1.4 0e930bdd5 -> 8cae10aba
  refs/heads/branch-2 d1e9c3d97 -> 99790a52a
  refs/heads/master 5e0d00f88 -> c0da74f7c


HBASE-19406 Fix CompactionRequest equals and hashCode


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d2a54c98
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d2a54c98
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d2a54c98

Branch: refs/heads/branch-1
Commit: d2a54c98bab30dce3698e4b1e0074cc575a63832
Parents: 68ee26d
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Dec 1 14:18:24 2017 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Dec 1 19:15:05 2017 -0800

----------------------------------------------------------------------
 .../compactions/CompactionRequest.java          | 69 +++++++++++++++++++-
 1 file changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d2a54c98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
index 9d67af5..7936260 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
@@ -26,7 +26,6 @@ import com.google.common.collect.Collections2;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Objects;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
@@ -142,12 +141,76 @@ public class CompactionRequest implements Comparable<CompactionRequest> {
 
   @Override
   public int hashCode() {
-    return System.identityHashCode(this);
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((filesToCompact == null) ? 0 : filesToCompact.hashCode());
+    result = prime * result + ((isMajor == null) ? 0 : isMajor.hashCode());
+    result = prime * result + (isOffPeak ? 1231 : 1237);
+    result = prime * result + priority;
+    result = prime * result + ((regionName == null) ? 0 : regionName.hashCode());
+    result = prime * result + (int) (selectionTime ^ (selectionTime >>> 32));
+    result = prime * result + ((storeName == null) ? 0 : storeName.hashCode());
+    result = prime * result + ((timeInNanos == null) ? 0 : timeInNanos.hashCode());
+    result = prime * result + (int) (totalSize ^ (totalSize >>> 32));
+    return result;
   }
 
   @Override
   public boolean equals(Object obj) {
-    return Objects.equals(this, obj);
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    CompactionRequest other = (CompactionRequest) obj;
+    if (filesToCompact == null) {
+      if (other.filesToCompact != null) {
+        return false;
+      }
+    } else if (!filesToCompact.equals(other.filesToCompact)) {
+      return false;
+    }
+    if (isMajor != other.isMajor) {
+      return false;
+    }
+    if (isOffPeak != other.isOffPeak) {
+      return false;
+    }
+    if (priority != other.priority) {
+      return false;
+    }
+    if (regionName == null) {
+      if (other.regionName != null) {
+        return false;
+      }
+    } else if (!regionName.equals(other.regionName)) {
+      return false;
+    }
+    if (selectionTime != other.selectionTime) {
+      return false;
+    }
+    if (storeName == null) {
+      if (other.storeName != null) {
+        return false;
+      }
+    } else if (!storeName.equals(other.storeName)) {
+      return false;
+    }
+    if (timeInNanos == null) {
+      if (other.timeInNanos != null) {
+        return false;
+      }
+    } else if (!timeInNanos.equals(other.timeInNanos)) {
+      return false;
+    }
+    if (totalSize != other.totalSize) {
+      return false;
+    }
+    return true;
   }
 
   public Collection<StoreFile> getFiles() {


[2/4] hbase git commit: HBASE-19406 Fix CompactionRequest equals and hashCode

Posted by ap...@apache.org.
HBASE-19406 Fix CompactionRequest equals and hashCode


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8cae10ab
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8cae10ab
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8cae10ab

Branch: refs/heads/branch-1.4
Commit: 8cae10abac3c85345fca7b0959af1b19aee60236
Parents: 0e930bd
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Dec 1 14:18:24 2017 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Dec 1 19:15:09 2017 -0800

----------------------------------------------------------------------
 .../compactions/CompactionRequest.java          | 69 +++++++++++++++++++-
 1 file changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/8cae10ab/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
index 9d67af5..7936260 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
@@ -26,7 +26,6 @@ import com.google.common.collect.Collections2;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Objects;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
@@ -142,12 +141,76 @@ public class CompactionRequest implements Comparable<CompactionRequest> {
 
   @Override
   public int hashCode() {
-    return System.identityHashCode(this);
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((filesToCompact == null) ? 0 : filesToCompact.hashCode());
+    result = prime * result + ((isMajor == null) ? 0 : isMajor.hashCode());
+    result = prime * result + (isOffPeak ? 1231 : 1237);
+    result = prime * result + priority;
+    result = prime * result + ((regionName == null) ? 0 : regionName.hashCode());
+    result = prime * result + (int) (selectionTime ^ (selectionTime >>> 32));
+    result = prime * result + ((storeName == null) ? 0 : storeName.hashCode());
+    result = prime * result + ((timeInNanos == null) ? 0 : timeInNanos.hashCode());
+    result = prime * result + (int) (totalSize ^ (totalSize >>> 32));
+    return result;
   }
 
   @Override
   public boolean equals(Object obj) {
-    return Objects.equals(this, obj);
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    CompactionRequest other = (CompactionRequest) obj;
+    if (filesToCompact == null) {
+      if (other.filesToCompact != null) {
+        return false;
+      }
+    } else if (!filesToCompact.equals(other.filesToCompact)) {
+      return false;
+    }
+    if (isMajor != other.isMajor) {
+      return false;
+    }
+    if (isOffPeak != other.isOffPeak) {
+      return false;
+    }
+    if (priority != other.priority) {
+      return false;
+    }
+    if (regionName == null) {
+      if (other.regionName != null) {
+        return false;
+      }
+    } else if (!regionName.equals(other.regionName)) {
+      return false;
+    }
+    if (selectionTime != other.selectionTime) {
+      return false;
+    }
+    if (storeName == null) {
+      if (other.storeName != null) {
+        return false;
+      }
+    } else if (!storeName.equals(other.storeName)) {
+      return false;
+    }
+    if (timeInNanos == null) {
+      if (other.timeInNanos != null) {
+        return false;
+      }
+    } else if (!timeInNanos.equals(other.timeInNanos)) {
+      return false;
+    }
+    if (totalSize != other.totalSize) {
+      return false;
+    }
+    return true;
   }
 
   public Collection<StoreFile> getFiles() {


[3/4] hbase git commit: HBASE-19406 Fix CompactionRequest equals and hashCode

Posted by ap...@apache.org.
HBASE-19406 Fix CompactionRequest equals and hashCode


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c0da74f7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c0da74f7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c0da74f7

Branch: refs/heads/master
Commit: c0da74f7c1fefe1df60c8a3e64534eeda97257ef
Parents: 5e0d00f
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Dec 1 14:25:28 2017 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Dec 1 19:15:11 2017 -0800

----------------------------------------------------------------------
 .../compactions/CompactionRequestImpl.java      | 74 ++++++++++++++++++++
 1 file changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c0da74f7/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
index 0c32a17..ff516a5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
@@ -137,6 +137,80 @@ public class CompactionRequestImpl implements CompactionRequest {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((filesToCompact == null) ? 0 : filesToCompact.hashCode());
+    result = prime * result + ((isMajor == null) ? 0 : isMajor.hashCode());
+    result = prime * result + (isOffPeak ? 1231 : 1237);
+    result = prime * result + priority;
+    result = prime * result + ((regionName == null) ? 0 : regionName.hashCode());
+    result = prime * result + (int) (selectionTime ^ (selectionTime >>> 32));
+    result = prime * result + ((storeName == null) ? 0 : storeName.hashCode());
+    result = prime * result + (int) (totalSize ^ (totalSize >>> 32));
+    result = prime * result + ((tracker == null) ? 0 : tracker.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    CompactionRequestImpl other = (CompactionRequestImpl) obj;
+    if (filesToCompact == null) {
+      if (other.filesToCompact != null) {
+        return false;
+      }
+    } else if (!filesToCompact.equals(other.filesToCompact)) {
+      return false;
+    }
+    if (isMajor != other.isMajor) {
+      return false;
+    }
+    if (isOffPeak != other.isOffPeak) {
+      return false;
+    }
+    if (priority != other.priority) {
+      return false;
+    }
+    if (regionName == null) {
+      if (other.regionName != null) {
+        return false;
+      }
+    } else if (!regionName.equals(other.regionName)) {
+      return false;
+    }
+    if (selectionTime != other.selectionTime) {
+      return false;
+    }
+    if (storeName == null) {
+      if (other.storeName != null) {
+        return false;
+      }
+    } else if (!storeName.equals(other.storeName)) {
+      return false;
+    }
+    if (totalSize != other.totalSize) {
+      return false;
+    }
+    if (tracker == null) {
+      if (other.tracker != null) {
+        return false;
+      }
+    } else if (!tracker.equals(other.tracker)) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
   public String toString() {
     String fsList = filesToCompact.stream().filter(f -> f.getReader() != null)
         .map(f -> TraditionalBinaryPrefix.long2String(f.getReader().length(), "", 1))


[4/4] hbase git commit: HBASE-19406 Fix CompactionRequest equals and hashCode

Posted by ap...@apache.org.
HBASE-19406 Fix CompactionRequest equals and hashCode


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/99790a52
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/99790a52
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/99790a52

Branch: refs/heads/branch-2
Commit: 99790a52ae49883f8a2afad14b7e522becc8571b
Parents: d1e9c3d
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Dec 1 14:25:28 2017 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Dec 1 19:15:11 2017 -0800

----------------------------------------------------------------------
 .../compactions/CompactionRequestImpl.java      | 74 ++++++++++++++++++++
 1 file changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/99790a52/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
index 0c32a17..ff516a5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequestImpl.java
@@ -137,6 +137,80 @@ public class CompactionRequestImpl implements CompactionRequest {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((filesToCompact == null) ? 0 : filesToCompact.hashCode());
+    result = prime * result + ((isMajor == null) ? 0 : isMajor.hashCode());
+    result = prime * result + (isOffPeak ? 1231 : 1237);
+    result = prime * result + priority;
+    result = prime * result + ((regionName == null) ? 0 : regionName.hashCode());
+    result = prime * result + (int) (selectionTime ^ (selectionTime >>> 32));
+    result = prime * result + ((storeName == null) ? 0 : storeName.hashCode());
+    result = prime * result + (int) (totalSize ^ (totalSize >>> 32));
+    result = prime * result + ((tracker == null) ? 0 : tracker.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    CompactionRequestImpl other = (CompactionRequestImpl) obj;
+    if (filesToCompact == null) {
+      if (other.filesToCompact != null) {
+        return false;
+      }
+    } else if (!filesToCompact.equals(other.filesToCompact)) {
+      return false;
+    }
+    if (isMajor != other.isMajor) {
+      return false;
+    }
+    if (isOffPeak != other.isOffPeak) {
+      return false;
+    }
+    if (priority != other.priority) {
+      return false;
+    }
+    if (regionName == null) {
+      if (other.regionName != null) {
+        return false;
+      }
+    } else if (!regionName.equals(other.regionName)) {
+      return false;
+    }
+    if (selectionTime != other.selectionTime) {
+      return false;
+    }
+    if (storeName == null) {
+      if (other.storeName != null) {
+        return false;
+      }
+    } else if (!storeName.equals(other.storeName)) {
+      return false;
+    }
+    if (totalSize != other.totalSize) {
+      return false;
+    }
+    if (tracker == null) {
+      if (other.tracker != null) {
+        return false;
+      }
+    } else if (!tracker.equals(other.tracker)) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
   public String toString() {
     String fsList = filesToCompact.stream().filter(f -> f.getReader() != null)
         .map(f -> TraditionalBinaryPrefix.long2String(f.getReader().length(), "", 1))