hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1478134 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Date Wed, 01 May 2013 18:18:16 GMT
Author: liyin
Date: Wed May  1 18:18:15 2013
New Revision: 1478134

URL: http://svn.apache.org/r1478134
Log:
[0.89-fb] [HBASE-8476]  locateRegionInMeta should check the cache before doing the prefetch

Author: aaiyer

Summary:
When we start a hbase client, all threads
need to synchronize to avoid accessing the META region
at the same time.

However, we need to check if the region cache is populated
before going to META. Without this, each thread will end up
fetching entries from META, losing any possible optimisation
for reducing the queries to META.

Test Plan:
pushed to titanshadow025 and see  a much faster
htable opens.

 run mr unit tests

Reviewers: rshroff, manukranthk, liyintang, anshumansingh26

Reviewed By: anshumansingh26

CC: hbase-eng@, anshumansingh26

Differential Revision: https://phabricator.fb.com/D795230

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

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1478134&r1=1478133&r2=1478134&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Wed May  1 18:18:15 2013
@@ -1037,13 +1037,6 @@ 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
@@ -1057,6 +1050,13 @@ public class HConnectionManager {
               deleteCachedLocation(tableName, row, null);
             }
 
+            // 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);
+            }
+
           // Query the root or meta region for the location of the meta region
             regionInfoRow = serverInterface.getClosestRowBefore(
             metaLocation.getRegionInfo().getRegionName(), metaKey,



Mime
View raw message