[ 
https://issues.apache.org/jira/browse/HBASE-16570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15616413#comment-15616413
 ] 

Gary Helmling commented on HBASE-16570:
---------------------------------------

[~aoxiang], thanks for putting together an addendum.

Yes, I understand that prior to this change, we were basically serializing the 
initialization of the cache.

Looking over your patch, the key area where the parallel initialization is 
needed is in BaseLoadBalancer.retainAssignment(), correct?

I think this would be cleaner if we refactor the original change and the 
addendum so that the cache refresh logic is abstracted in RegionLocationFinder. 
 Currently we have RegionLocationFinder.asyncBlockDistribution() returning 
futures which Cluster.<init> is then waiting on, which seems like a bit of a 
bleeding of abstractions to me.

I'd propose that we:

* add a {{RegionLocationFinder.refreshAndWait(Collection<HRegionInfo> hris)}} 
method.  Internally, this can call {{asyncGetBlockDistribution(HRegionInfo)}} 
on each HRI and then loop through each of the futures and do a {{get()}}
* make {{asyncGetBlockDistribution(HRegionInfo)}} private
* add a boolean flag (as your addendum does) to 
{{BaseLoadBalancer.createCluster((List<ServerName> servers, 
Collection<HRegionInfo> regions, boolean forceRefresh)}}
* {{if (forceRefresh == true) regionFinder.refreshAndWait(regions);}} before 
instantiating Cluster
* pass true for the flag in the call in {{retainAssignments()}}, false elsewhere
* revert the changes in {{Cluster}} to the version prior to this change 
originally going in

I think that would cover what you're trying to achieve here, with initially 
populating the cache in parallel when master starts up, and would better 
abstract the logic.  {{Cluster.<init>}} would be free of any knowledge of this 
and the BalancerChore would simply run using the cache.

Let me know what you think or if I'm missing something.

> Compute region locality in parallel at startup
> ----------------------------------------------
>
>                 Key: HBASE-16570
>                 URL: https://issues.apache.org/jira/browse/HBASE-16570
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: binlijin
>            Assignee: binlijin
>             Fix For: 2.0.0, 1.4.0, 1.3.1
>
>         Attachments: HBASE-16570-master_V1.patch, 
> HBASE-16570-master_V2.patch, HBASE-16570-master_V3.patch, 
> HBASE-16570-master_V4.patch, HBASE-16570.branch-1.3-addendum.patch, 
> HBASE-16570_addnum.patch, HBASE-16570_addnum_v2.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to