You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2013/05/02 23:56:45 UTC

svn commit: r1478586 - /hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Author: tedyu
Date: Thu May  2 21:56:44 2013
New Revision: 1478586

URL: http://svn.apache.org/r1478586
Log:
HBASE-8346 Prefetching .META. rows in case only when useCache is set to true (Himanshu)


Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1478586&r1=1478585&r2=1478586&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Thu May  2 21:56:44 2013
@@ -1149,26 +1149,28 @@ public class HConnectionManager {
           // region at the same time. The first will load the meta region and
           // the second will use the value that the first one found.
           synchronized (regionLockObject) {
-            // If the parent table is META, we may want to pre-fetch some
-            // region info into the global region cache for this table.
-            if (Bytes.equals(parentTable, HConstants.META_TABLE_NAME) &&
-                (getRegionCachePrefetch(tableName)) )  {
-              prefetchRegionCache(tableName, row);
-            }
-
             // Check the cache again for a hit in case some other thread made the
-            // same query while we were waiting on the lock. If not supposed to
-            // be using the cache, delete any existing cached location so it won't
-            // interfere.
+            // same query while we were waiting on the lock. 
             if (useCache) {
               location = getCachedLocation(tableName, row);
               if (location != null) {
                 return location;
               }
+              // If the parent table is META, we may want to pre-fetch some
+              // region info into the global region cache for this table.
+              if (Bytes.equals(parentTable, HConstants.META_TABLE_NAME)
+                  && (getRegionCachePrefetch(tableName))) {
+                prefetchRegionCache(tableName, row);
+              }
+              location = getCachedLocation(tableName, row);
+              if (location != null) {
+                return location;
+              }
             } else {
+              // If we are not supposed to be using the cache, delete any existing cached location
+              // so it won't interfere.
               forceDeleteCachedLocation(tableName, row);
             }
-
             // Query the meta region for the location of the meta region
             regionInfoRow = ProtobufUtil.getRowOrBefore(server,
               metaLocation.getRegionInfo().getRegionName(), metaKey,