HADOOP-2553 Don't make Long objects calculating hbase type hash codes

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@610698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-01-10 06:57:00 +00:00
parent 765ee86279
commit df0f5658a5
8 changed files with 10 additions and 11 deletions

View File

@ -162,6 +162,7 @@ Trunk (unreleased changes)
(Edward Yoon via Stack) (Edward Yoon via Stack)
HADOOP-2450 Show version (and svn revision) in hbase web ui HADOOP-2450 Show version (and svn revision) in hbase web ui
HADOOP-2472 Range selection using filter (Edward Yoon via Stack) HADOOP-2472 Range selection using filter (Edward Yoon via Stack)
HADOOP-2553 Don't make Long objects calculating hbase type hash codes

View File

@ -332,13 +332,13 @@ public class HLog implements HConstants {
// equal to the oldest pending region operation // equal to the oldest pending region operation
TreeSet<Long> sequenceNumbers = TreeSet<Long> sequenceNumbers =
new TreeSet<Long>(this.outputfiles.headMap( new TreeSet<Long>(this.outputfiles.headMap(
(oldestOutstandingSeqNum + Long.valueOf(1L))).keySet()); (Long.valueOf(oldestOutstandingSeqNum.longValue() + 1L))).keySet());
// Now remove old log files (if any) // Now remove old log files (if any)
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
// Find region associated with oldest key -- helps debugging. // Find region associated with oldest key -- helps debugging.
Text oldestRegion = null; Text oldestRegion = null;
for (Map.Entry<Text, Long> e: this.lastSeqWritten.entrySet()) { for (Map.Entry<Text, Long> e: this.lastSeqWritten.entrySet()) {
if (e.getValue().longValue() == oldestOutstandingSeqNum) { if (e.getValue().longValue() == oldestOutstandingSeqNum.longValue()) {
oldestRegion = e.getKey(); oldestRegion = e.getKey();
break; break;
} }

View File

@ -102,7 +102,7 @@ public class HLogKey implements WritableComparable {
public int hashCode() { public int hashCode() {
int result = this.regionName.hashCode(); int result = this.regionName.hashCode();
result ^= this.row.hashCode(); result ^= this.row.hashCode();
result ^= Long.valueOf(this.logSeqNum).hashCode(); result ^= this.logSeqNum;
return result; return result;
} }

View File

@ -82,7 +82,7 @@ public class HRegionInfo implements WritableComparable {
private void setHashCode() { private void setHashCode() {
int result = this.regionName.hashCode(); int result = this.regionName.hashCode();
result ^= Long.valueOf(this.regionId).hashCode(); result ^= this.regionId;
result ^= this.startKey.hashCode(); result ^= this.startKey.hashCode();
result ^= this.endKey.hashCode(); result ^= this.endKey.hashCode();
result ^= Boolean.valueOf(this.offLine).hashCode(); result ^= Boolean.valueOf(this.offLine).hashCode();

View File

@ -229,14 +229,12 @@ class HStore implements HConstants {
// TODO: If get is of a particular version -- numVersions == 1 -- we // TODO: If get is of a particular version -- numVersions == 1 -- we
// should be able to avoid all of the tailmap creations and iterations // should be able to avoid all of the tailmap creations and iterations
// below. // below.
HStoreKey curKey = new HStoreKey(key); SortedMap<HStoreKey, byte []> tailMap = map.tailMap(key);
SortedMap<HStoreKey, byte []> tailMap = map.tailMap(curKey);
for (Map.Entry<HStoreKey, byte []> es: tailMap.entrySet()) { for (Map.Entry<HStoreKey, byte []> es: tailMap.entrySet()) {
HStoreKey itKey = es.getKey(); HStoreKey itKey = es.getKey();
if (itKey.matchesRowCol(curKey)) { if (itKey.matchesRowCol(key)) {
if (!HLogEdit.isDeleted(es.getValue())) { if (!HLogEdit.isDeleted(es.getValue())) {
result.add(tailMap.get(itKey)); result.add(tailMap.get(itKey));
curKey.setVersion(itKey.getTimestamp() - 1);
} }
} }
if (numVersions > 0 && result.size() >= numVersions) { if (numVersions > 0 && result.size() >= numVersions) {

View File

@ -995,7 +995,7 @@ public class HStoreFile implements HConstants, WritableComparable {
int result = this.dir.hashCode(); int result = this.dir.hashCode();
result ^= this.encodedRegionName.hashCode(); result ^= this.encodedRegionName.hashCode();
result ^= this.colFamily.hashCode(); result ^= this.colFamily.hashCode();
result ^= Long.valueOf(this.fileId).hashCode(); result ^= this.fileId;
return result; return result;
} }

View File

@ -219,7 +219,7 @@ public class HStoreKey implements WritableComparable {
public int hashCode() { public int hashCode() {
int result = this.row.hashCode(); int result = this.row.hashCode();
result ^= this.column.hashCode(); result ^= this.column.hashCode();
result ^= Long.valueOf(this.timestamp).hashCode(); result ^= this.timestamp;
return result; return result;
} }

View File

@ -354,7 +354,7 @@ public class Leases {
@Override @Override
public int hashCode() { public int hashCode() {
int result = this.getLeaseName().hashCode(); int result = this.getLeaseName().hashCode();
result ^= Long.valueOf(this.lastUpdate).hashCode(); result ^= this.lastUpdate;
return result; return result;
} }