hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1338916 - /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Tue, 15 May 2012 21:56:48 GMT
Author: tedyu
Date: Tue May 15 21:56:48 2012
New Revision: 1338916

URL: http://svn.apache.org/viewvc?rev=1338916&view=rev
Log:
HBASE-5998 Bulk assignment: regionserver optimization by using a temporary cache for table
descriptors when receveing an open regions request (N Keywal)

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1338916&r1=1338915&r2=1338916&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Tue
May 15 21:56:48 2012
@@ -3404,6 +3404,9 @@ public class  HRegionServer implements C
       requestCount.incrementAndGet();
       OpenRegionResponse.Builder
         builder = OpenRegionResponse.newBuilder();
+      Map<String, HTableDescriptor> htds =
+        new HashMap<String, HTableDescriptor>(request.getRegionList().size());
+
       for (RegionInfo regionInfo: request.getRegionList()) {
         HRegionInfo region = ProtobufUtil.toRegionInfo(regionInfo);
         checkIfRegionInTransition(region, OPEN);
@@ -3427,7 +3430,11 @@ public class  HRegionServer implements C
         }
         LOG.info("Received request to open region: "
           + region.getRegionNameAsString() + " on "+this.serverNameFromMasterPOV);
-        HTableDescriptor htd = this.tableDescriptors.get(region.getTableName());
+        HTableDescriptor htd = htds.get(region.getTableNameAsString());
+        if (htd == null) {
+          htd = this.tableDescriptors.get(region.getTableName());
+          htds.put(region.getTableNameAsString(), htd);
+        }
         this.regionsInTransitionInRS.putIfAbsent(region.getEncodedNameAsBytes(), true);
         // Need to pass the expected version in the constructor.
         if (region.isRootRegion()) {



Mime
View raw message