hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r680910 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HRegion.java src/java/org/apache/hadoop/hbase/regionserver/HStore.java
Date Wed, 30 Jul 2008 04:37:07 GMT
Author: stack
Date: Tue Jul 29 21:37:06 2008
New Revision: 680910

URL: http://svn.apache.org/viewvc?rev=680910&view=rev
Log:
HBASE-783 For single row, single family retrieval, getRow() works half as fast as getScanner().next()

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=680910&r1=680909&r2=680910&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue Jul 29 21:37:06 2008
@@ -324,6 +324,8 @@
    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

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=680910&r1=680909&r2=680910&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Tue Jul
29 21:37:06 2008
@@ -1181,23 +1181,40 @@
     }
     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);

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=680910&r1=680909&r2=680910&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java Tue Jul 29
21:37:06 2008
@@ -752,7 +752,8 @@
         // 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)) {



Mime
View raw message