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

Ted Yu commented on HBASE-20741:
--------------------------------

Thanks for the patch, Ram.
{code}
       final RegionInfo hri = 
RegionReplicaUtil.getRegionInfoForReplica(daughter_2_RI, i);
-      procs[procsIdx++] = 
env.getAssignmentManager().createAssignProcedure(hri, targetServer);
+      if (RegionReplicaUtil.isDefaultReplica(hri)) {
+        procs[procsIdx++] = 
env.getAssignmentManager().createAssignProcedure(hri, targetServer);
+      } else {
+        serverIdx = serverIdx % (onlineServers.size());
+        procs[procsIdx++] =
+            env.getAssignmentManager().createAssignProcedure(hri, 
onlineServers.get(serverIdx));
+        serverIdx++;
+      }
{code}
Previously there was only one call inside the if block. Now there are several 
lines of code which are similar for both daughter regions.
Please consider extracting such code into a method.

> Split of a region with replicas creates all daughter regions and its replica 
> in same server
> -------------------------------------------------------------------------------------------
>
>                 Key: HBASE-20741
>                 URL: https://issues.apache.org/jira/browse/HBASE-20741
>             Project: HBase
>          Issue Type: Bug
>          Components: read replicas
>    Affects Versions: 2.0.0
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Major
>             Fix For: 2.2.0
>
>         Attachments: HBASE-20741.patch
>
>
> Generally it is better that the parent region when split creates the daughter 
> region in the same target server. 
> But for replicas also we do the same and all the replica regions are created 
> in the same target server. We should ideally be doing a round robin and only 
> the primary daughter region should be opened in the intended target server 
> (where the parent was previously opened).
> [~huaxiang] FYI.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to