hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1553722 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Date Fri, 27 Dec 2013 19:18:20 GMT
Author: liyin
Date: Fri Dec 27 19:18:19 2013
New Revision: 1553722

URL: http://svn.apache.org/r1553722
[HBASE-10236] Avoid creating extra connection when locating a region

Author: gauravm

In Swift, I found that inside locateRegionInMeta(), we create a connection to meta, before
checking if the region's location is in the cache. Most of the time, we expect a hit, hence
most of the time, we end up creating a useless connection object. In swift, a lot of these
objects caused the thread pool to get exhausted while starting up.

This might not be a problem in trunk, but still it seems like an improvement.

Test Plan: Unit Tests

Reviewers: liyintang, aaiyer, rshroff, manukranthk, adela, fan

Reviewed By: fan

CC: hbase-eng@

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


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=1553722&r1=1553721&r2=1553722&view=diff
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Fri Dec 27 19:18:19 2013
@@ -1039,9 +1039,6 @@ public class HConnectionManager {
           didTry = true;
-          HRegionInterface serverInterface =
-            getHRegionConnection(metaLocation.getServerAddress());
           Result regionInfoRow = null;
           // This block guards against two threads trying to load the meta
           // region at the same time. The first will load the meta region and
@@ -1067,7 +1064,10 @@ public class HConnectionManager {
               prefetchRegionCache(tableName, row);
-          // Query the root or meta region for the location of the meta region
+            HRegionInterface serverInterface =
+              getHRegionConnection(metaLocation.getServerAddress());
+            // Query the root or meta region for the location of the meta region
             regionInfoRow = serverInterface.getClosestRowBefore(
             metaLocation.getRegionInfo().getRegionName(), metaKey,

View raw message