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 2016/08/01 23:04:52 UTC
[2/2] hbase git commit: Revert "HBASE-16272 Overflow in ServerName's
compareTo method (Huaxiang Sun)"
Revert "HBASE-16272 Overflow in ServerName's compareTo method (Huaxiang Sun)"
This reverts commit 6e54ac352ae2a7aae9cc804132126aee0c44b971.
JDK/JRE 6 does not have Long#compare
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6dfdc0d8
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6dfdc0d8
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6dfdc0d8
Branch: refs/heads/0.98
Commit: 6dfdc0d898b92371b8694ff4b32897ade8f53bcb
Parents: f750acb
Author: Andrew Purtell <ap...@apache.org>
Authored: Mon Aug 1 16:03:51 2016 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Aug 1 16:03:51 2016 -0700
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/hbase/ServerName.java | 2 +-
.../org/apache/hadoop/hbase/io/hfile/LruBlockCache.java | 7 ++++---
.../hadoop/hbase/io/hfile/bucket/BucketCache.java | 12 ++++++++----
.../java/org/apache/hadoop/hbase/util/HBaseFsck.java | 2 +-
4 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/6dfdc0d8/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerName.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerName.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerName.java
index ad03816..ec8fcb2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerName.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerName.java
@@ -290,7 +290,7 @@ public class ServerName implements Comparable<ServerName>, Serializable {
if (compare != 0) return compare;
compare = this.getPort() - other.getPort();
if (compare != 0) return compare;
- return Long.compare(this.getStartcode(), other.getStartcode());
+ return (int)(this.getStartcode() - other.getStartcode());
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/6dfdc0d8/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
index 65683b7..4afd556 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
@@ -714,7 +714,8 @@ public class LruBlockCache implements BlockCache, HeapSize {
}
public int compareTo(BlockBucket that) {
- return Long.compare(this.overflow(), that.overflow());
+ if(this.overflow() == that.overflow()) return 0;
+ return this.overflow() > that.overflow() ? 1 : -1;
}
@Override
@@ -949,13 +950,13 @@ public class LruBlockCache implements BlockCache, HeapSize {
public int compareTo(CachedBlock other) {
int diff = this.getFilename().compareTo(other.getFilename());
if (diff != 0) return diff;
- diff = Long.compare(this.getOffset(), other.getOffset());
+ diff = (int)(this.getOffset() - other.getOffset());
if (diff != 0) return diff;
if (other.getCachedTime() < 0 || this.getCachedTime() < 0) {
throw new IllegalStateException("" + this.getCachedTime() + ", " +
other.getCachedTime());
}
- return Long.compare(other.getCachedTime(), this.getCachedTime());
+ return (int)(other.getCachedTime() - this.getCachedTime());
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/6dfdc0d8/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
index 319d9c4..137a909 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
@@ -1090,7 +1090,9 @@ public class BucketCache implements BlockCache, HeapSize {
@Override
public int compare(BucketEntry o1, BucketEntry o2) {
- return Long.compare(o2.accessCounter, o1.accessCounter);
+ long accessCounter1 = o1.accessCounter;
+ long accessCounter2 = o2.accessCounter;
+ return accessCounter1 < accessCounter2 ? 1 : accessCounter1 == accessCounter2 ? 0 : -1;
}
};
@@ -1211,7 +1213,9 @@ public class BucketCache implements BlockCache, HeapSize {
@Override
public int compareTo(BucketEntryGroup that) {
- return Long.compare(this.overflow(), that.overflow());
+ if (this.overflow() == that.overflow())
+ return 0;
+ return this.overflow() > that.overflow() ? 1 : -1;
}
@Override
@@ -1358,13 +1362,13 @@ public class BucketCache implements BlockCache, HeapSize {
public int compareTo(CachedBlock other) {
int diff = this.getFilename().compareTo(other.getFilename());
if (diff != 0) return diff;
- diff = Long.compare(this.getOffset(), other.getOffset());
+ diff = (int)(this.getOffset() - other.getOffset());
if (diff != 0) return diff;
if (other.getCachedTime() < 0 || this.getCachedTime() < 0) {
throw new IllegalStateException("" + this.getCachedTime() + ", " +
other.getCachedTime());
}
- return Long.compare(other.getCachedTime(), this.getCachedTime());
+ return (int)(other.getCachedTime() - this.getCachedTime());
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/6dfdc0d8/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
index 67d4a4e..5a1f84f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
@@ -3118,7 +3118,7 @@ public class HBaseFsck extends Configured {
final Comparator<Cell> comp = new Comparator<Cell>() {
@Override
public int compare(Cell k1, Cell k2) {
- return Long.compare(k1.getTimestamp(), k2.getTimestamp());
+ return (int)(k1.getTimestamp() - k2.getTimestamp());
}
};