JacksonYao287 commented on a change in pull request #2349:
URL: https://github.com/apache/ozone/pull/2349#discussion_r660249416
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
##########
@@ -862,16 +1061,55 @@ private void handleOverReplicatedContainer(final
ContainerInfo container,
break;
}
}
+
+ eligibleReplicas.removeAll(unhealthyReplicas);
+ boolean isInMove = inflightMove.containsKey(id);
+ boolean isSourceDnInReplicaSet = false;
+ boolean isTargetDnInReplicaSet = false;
+
+ if (isInMove) {
+ Pair<DatanodeDetails, DatanodeDetails> movePair =
+ inflightMove.get(id);
+ final DatanodeDetails sourceDN = movePair.getKey();
+ isSourceDnInReplicaSet = eligibleReplicas.stream()
+ .anyMatch(r -> r.getDatanodeDetails().equals(sourceDN));
+ isTargetDnInReplicaSet = eligibleReplicas.stream()
+ .anyMatch(r -> r.getDatanodeDetails()
+ .equals(movePair.getValue()));
+ int sourceDnPos = 0;
+ for (int i = 0; i < eligibleReplicas.size(); i++) {
+ if (eligibleReplicas.get(i).getDatanodeDetails()
+ .equals(sourceDN)) {
+ sourceDnPos = i;
+ break;
+ }
+ }
+ if (isTargetDnInReplicaSet) {
+ // if the container is in inflightMove and target datanode is
+ // included in the replicas, then swap the source datanode to
+ // first of the replica list if exists, so the source datanode
+ // will be first removed if possible.
+ eligibleReplicas.add(0, eligibleReplicas.remove(sourceDnPos));
+ } else {
+ // a container replica that being moved should not be removed.
+ // if the container is in inflightMove and target datanode is not
+ // included in the replicas, then swap the source datanode to the
+ // last of the replica list, so the source datanode will not
+ // be removed.
+ eligibleReplicas.add(eligibleReplicas.remove(sourceDnPos));
Review comment:
> TargetDN would receive all the existing replicas as source to copy from
in move option, we maintain src and target in inflightMove and track the
replication from source to target. if we take other the existing replicas as
the source, Although the final result seems same(sourceDN is not present and
targetDN is present), it seems a little confused in Semantics. i think it will
better off making sure the source not be deleted until the target is present.
> I think that at end if sourceDN is not present and targetDN is present
move is successful.
yes , it make sense. if the target is present, and source disappear somehow,
we can consider move is successful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]