[
https://issues.apache.org/jira/browse/HBASE-21102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16606496#comment-16606496
]
huaxiang sun commented on HBASE-21102:
--------------------------------------
+1, a nit, the following else branch does not seem necessary. I did a test to
verify that.
{code}
+ List<ServerName> usedSNs = new ArrayList<ServerName>(servers.size());
do {
int i = RANDOM.nextInt(numServers);
sn = servers.get(i);
+ if (!usedSNs.contains(sn)) {
+ usedSNs.add(sn);
+ } else {
+ continue;
+ }
// Huaxiang: the else branch does not seem necessary. I did a test, with
continue, it still // goes through the while conditions.
} while (cluster.wouldLowerAvailability(regionInfo, sn)
&& iterations++ < maxIterations);
+ if (iterations >= maxIterations) {
+ // We have reached the max. Means the servers that we collected is still
lowering the
+ // availability
+ for (ServerName unusedServer : servers) {
+ if (!usedSNs.contains(unusedServer)) {
+ // check if any other unused server is there for us to use.
+ // If so use it. Else we have not other go but to go with one of them
+ if (!cluster.wouldLowerAvailability(regionInfo, unusedServer)) {
+ sn = unusedServer;
+ break;
+ }
+ }
+ }
+ }
{code}
> ServerCrashProcedure should select target server where no other replicas
> exist for the current region
> -----------------------------------------------------------------------------------------------------
>
> Key: HBASE-21102
> URL: https://issues.apache.org/jira/browse/HBASE-21102
> Project: HBase
> Issue Type: Bug
> Components: Region Assignment
> Affects Versions: 3.0.0
> Reporter: ramkrishna.s.vasudevan
> Assignee: ramkrishna.s.vasudevan
> Priority: Major
> Attachments: HBASE-21102_1.patch, HBASE-21102_2.patch,
> HBASE-21102_3.patch, HBASE-21102_initial.patch
>
>
> Currently when a server with region replica crashes, when the target server
> is created for the replica region assignment there is no guarentee that a
> server is selected where there is no other replica for the current region
> getting assigned. It so happens that currently we do an assignment randomly
> and later the LB comes and identifies these cases and again does MOVE for
> such regions. It will be better if we can identify target servers at least
> minimally ensuring that replicas are not colocated.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)