diff --git a/CHANGES.txt b/CHANGES.txt index 125f4f5b762..6e5adb1749f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -162,6 +162,7 @@ Trunk (unreleased changes) (Edward Yoon via Stack) HADOOP-2450 Show version (and svn revision) in hbase web ui HADOOP-2472 Range selection using filter (Edward Yoon via Stack) + HADOOP-2553 Don't make Long objects calculating hbase type hash codes diff --git a/src/java/org/apache/hadoop/hbase/HLog.java b/src/java/org/apache/hadoop/hbase/HLog.java index ef5f88fc5b6..7fa990a0b0d 100644 --- a/src/java/org/apache/hadoop/hbase/HLog.java +++ b/src/java/org/apache/hadoop/hbase/HLog.java @@ -332,13 +332,13 @@ public class HLog implements HConstants { // equal to the oldest pending region operation TreeSet sequenceNumbers = new TreeSet(this.outputfiles.headMap( - (oldestOutstandingSeqNum + Long.valueOf(1L))).keySet()); + (Long.valueOf(oldestOutstandingSeqNum.longValue() + 1L))).keySet()); // Now remove old log files (if any) if (LOG.isDebugEnabled()) { // Find region associated with oldest key -- helps debugging. Text oldestRegion = null; for (Map.Entry e: this.lastSeqWritten.entrySet()) { - if (e.getValue().longValue() == oldestOutstandingSeqNum) { + if (e.getValue().longValue() == oldestOutstandingSeqNum.longValue()) { oldestRegion = e.getKey(); break; } diff --git a/src/java/org/apache/hadoop/hbase/HLogKey.java b/src/java/org/apache/hadoop/hbase/HLogKey.java index c81822fca4d..663d40b85f6 100644 --- a/src/java/org/apache/hadoop/hbase/HLogKey.java +++ b/src/java/org/apache/hadoop/hbase/HLogKey.java @@ -102,7 +102,7 @@ public class HLogKey implements WritableComparable { public int hashCode() { int result = this.regionName.hashCode(); result ^= this.row.hashCode(); - result ^= Long.valueOf(this.logSeqNum).hashCode(); + result ^= this.logSeqNum; return result; } diff --git a/src/java/org/apache/hadoop/hbase/HRegionInfo.java b/src/java/org/apache/hadoop/hbase/HRegionInfo.java index bc311053722..1f202527270 100644 --- a/src/java/org/apache/hadoop/hbase/HRegionInfo.java +++ b/src/java/org/apache/hadoop/hbase/HRegionInfo.java @@ -82,7 +82,7 @@ public class HRegionInfo implements WritableComparable { private void setHashCode() { int result = this.regionName.hashCode(); - result ^= Long.valueOf(this.regionId).hashCode(); + result ^= this.regionId; result ^= this.startKey.hashCode(); result ^= this.endKey.hashCode(); result ^= Boolean.valueOf(this.offLine).hashCode(); diff --git a/src/java/org/apache/hadoop/hbase/HStore.java b/src/java/org/apache/hadoop/hbase/HStore.java index a3f94d2f8ae..322f4984cd0 100644 --- a/src/java/org/apache/hadoop/hbase/HStore.java +++ b/src/java/org/apache/hadoop/hbase/HStore.java @@ -229,14 +229,12 @@ class HStore implements HConstants { // TODO: If get is of a particular version -- numVersions == 1 -- we // should be able to avoid all of the tailmap creations and iterations // below. - HStoreKey curKey = new HStoreKey(key); - SortedMap tailMap = map.tailMap(curKey); + SortedMap tailMap = map.tailMap(key); for (Map.Entry es: tailMap.entrySet()) { HStoreKey itKey = es.getKey(); - if (itKey.matchesRowCol(curKey)) { + if (itKey.matchesRowCol(key)) { if (!HLogEdit.isDeleted(es.getValue())) { result.add(tailMap.get(itKey)); - curKey.setVersion(itKey.getTimestamp() - 1); } } if (numVersions > 0 && result.size() >= numVersions) { diff --git a/src/java/org/apache/hadoop/hbase/HStoreFile.java b/src/java/org/apache/hadoop/hbase/HStoreFile.java index 82a4765f3c7..d9f1fcccd97 100644 --- a/src/java/org/apache/hadoop/hbase/HStoreFile.java +++ b/src/java/org/apache/hadoop/hbase/HStoreFile.java @@ -995,7 +995,7 @@ public class HStoreFile implements HConstants, WritableComparable { int result = this.dir.hashCode(); result ^= this.encodedRegionName.hashCode(); result ^= this.colFamily.hashCode(); - result ^= Long.valueOf(this.fileId).hashCode(); + result ^= this.fileId; return result; } diff --git a/src/java/org/apache/hadoop/hbase/HStoreKey.java b/src/java/org/apache/hadoop/hbase/HStoreKey.java index 512aef77756..d9814427979 100644 --- a/src/java/org/apache/hadoop/hbase/HStoreKey.java +++ b/src/java/org/apache/hadoop/hbase/HStoreKey.java @@ -219,7 +219,7 @@ public class HStoreKey implements WritableComparable { public int hashCode() { int result = this.row.hashCode(); result ^= this.column.hashCode(); - result ^= Long.valueOf(this.timestamp).hashCode(); + result ^= this.timestamp; return result; } diff --git a/src/java/org/apache/hadoop/hbase/Leases.java b/src/java/org/apache/hadoop/hbase/Leases.java index 57d28b2fac9..4f3a7580c92 100644 --- a/src/java/org/apache/hadoop/hbase/Leases.java +++ b/src/java/org/apache/hadoop/hbase/Leases.java @@ -354,7 +354,7 @@ public class Leases { @Override public int hashCode() { int result = this.getLeaseName().hashCode(); - result ^= Long.valueOf(this.lastUpdate).hashCode(); + result ^= this.lastUpdate; return result; }