HBASE-682 unnecessary iteration in HMemcache.internalGet? got much better reading performance after break it.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@667631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-06-13 19:53:23 +00:00
parent 82639a32fd
commit 1bc0a2a0a3
2 changed files with 12 additions and 6 deletions

View File

@ -47,8 +47,11 @@ Hbase Change Log
HBASE-662 UI in table.jsp gives META locations, not the table's regions HBASE-662 UI in table.jsp gives META locations, not the table's regions
location (Jean-Daniel Cryans via Stack) location (Jean-Daniel Cryans via Stack)
HBASE-676 Bytes.getInt returns a long (Clint Morgan via Stack) HBASE-676 Bytes.getInt returns a long (Clint Morgan via Stack)
HBASE-680 config parameter hbase.io.index.interval should be HBASE-680 Config parameter hbase.io.index.interval should be
hbase.index.interval, according to HBaseMapFile.HbaseWriter hbase.index.interval, according to HBaseMapFile.HbaseWriter
(LN via Stack)
HBASE-682 Unnecessary iteration in HMemcache.internalGet? got much better
reading performance after break it (LN via Stack)
IMPROVEMENTS IMPROVEMENTS
HBASE-559 MR example job to count table rows HBASE-559 MR example job to count table rows

View File

@ -514,6 +514,9 @@ class Memcache {
if (ttl == HConstants.FOREVER || if (ttl == HConstants.FOREVER ||
now < itKey.getTimestamp() + ttl) { now < itKey.getTimestamp() + ttl) {
result.add(new Cell(tailMap.get(itKey), itKey.getTimestamp())); result.add(new Cell(tailMap.get(itKey), itKey.getTimestamp()));
if (numVersions > 0 && result.size() >= numVersions) {
break;
}
} else { } else {
victims.add(itKey); victims.add(itKey);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
@ -521,15 +524,15 @@ class Memcache {
} }
} }
} }
} } else {
if (numVersions > 0 && result.size() >= numVersions) { // By L.N. HBASE-684, map is sorted, so we can't find match any more.
break; break;
} }
} }
// Remove expired victims from the map. // Remove expired victims from the map.
for (HStoreKey v: victims) for (HStoreKey v: victims) {
map.remove(v); map.remove(v);
}
return result; return result;
} }