HBASE-5998 Bulk assignment: regionserver optimization by using a temporary cache for table descriptors when receveing an open regions request (N Keywal)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1338916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-05-15 21:56:48 +00:00
parent e702947482
commit 7693a7c9f2
1 changed files with 8 additions and 1 deletions

View File

@ -3404,6 +3404,9 @@ public class HRegionServer implements ClientProtocol,
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 ClientProtocol,
}
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()) {