HBASE-783 For single row, single family retrieval, getRow() works half as fast as getScanner().next()
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@680910 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
410a8266c0
commit
809180eef2
|
@ -324,6 +324,8 @@ Release 0.2.0
|
|||
HBASE-746 Batching row mutations via thrift (Tim Sell via Stack)
|
||||
HBASE-772 Up default lease period from 60 to 120 seconds
|
||||
HBASE-779 Test changing hbase.hregion.memcache.block.multiplier to 2
|
||||
HBASE-783 For single row, single family retrieval, getRow() works half
|
||||
as fast as getScanner().next() (Jean-Daniel Cryans via Stack)
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-47 Option to set TTL for columns in hbase
|
||||
|
|
|
@ -1181,23 +1181,40 @@ public class HRegion implements HConstants {
|
|||
}
|
||||
HStoreKey key = new HStoreKey(row, ts);
|
||||
Integer lid = obtainRowLock(row);
|
||||
HashSet<HStore> storeSet = new HashSet<HStore>();
|
||||
try {
|
||||
TreeMap<byte [], Cell> result =
|
||||
new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
|
||||
for (HStore targetStore: stores.values()) {
|
||||
targetStore.getFull(key, columns, result);
|
||||
// Get the concerned columns or all of them
|
||||
if (columns != null) {
|
||||
for (byte[] bs : columns) {
|
||||
HStore store = stores.get(Bytes.mapKey(HStoreKey.getFamily(bs)));
|
||||
if (store != null) {
|
||||
storeSet.add(store);
|
||||
}
|
||||
// Previous step won't fetch whole families: HBASE-631.
|
||||
}
|
||||
}
|
||||
else
|
||||
storeSet.addAll(stores.values());
|
||||
|
||||
// For each column name that is just a column family, open the store
|
||||
// related to it and fetch everything for that row.
|
||||
// related to it and fetch everything for that row. HBASE-631
|
||||
// Also remove each store from storeSet so that these stores
|
||||
// won't be opened for no reason. HBASE-783
|
||||
if (columns != null) {
|
||||
for (byte[] bs : columns) {
|
||||
if (HStoreKey.getFamilyDelimiterIndex(bs) == (bs.length - 1)) {
|
||||
HStore store = stores.get(Bytes.mapKey(HStoreKey.getFamily(bs)));
|
||||
store.getFull(key, null, result);
|
||||
storeSet.remove(store);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (HStore targetStore: storeSet) {
|
||||
targetStore.getFull(key, columns, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
} finally {
|
||||
releaseRowLock(lid);
|
||||
|
|
|
@ -752,7 +752,8 @@ public class HStore implements HConstants {
|
|||
// last key of storefiles.
|
||||
maxId = this.storefiles.lastKey().longValue();
|
||||
}
|
||||
if (!force && filesToCompact.size() < compactionThreshold) {
|
||||
if (!force && !hasReferences(filesToCompact) &&
|
||||
filesToCompact.size() < compactionThreshold) {
|
||||
return checkSplit();
|
||||
}
|
||||
if (!fs.exists(compactionDir) && !fs.mkdirs(compactionDir)) {
|
||||
|
|
Loading…
Reference in New Issue