siddhantsangwan commented on code in PR #6305:
URL: https://github.com/apache/ozone/pull/6305#discussion_r1520953899
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerTask.java:
##########
@@ -856,19 +860,34 @@ private boolean moveContainer(DatanodeDetails source,
" {} failed: {}",
moveSelection.getContainerID(), source.getUuidString(),
moveSelection.getTargetNode().getUuidString(), result);
+ // add source back if move failed due to container related errors
+ if (result ==
MoveManager.MoveResult.REPLICATION_FAIL_NOT_EXIST_IN_SOURCE ||
+ result ==
MoveManager.MoveResult.REPLICATION_FAIL_EXIST_IN_TARGET ||
+ result ==
MoveManager.MoveResult.REPLICATION_FAIL_CONTAINER_NOT_CLOSED ||
+ result ==
MoveManager.MoveResult.REPLICATION_FAIL_INFLIGHT_DELETION ||
+ result ==
MoveManager.MoveResult.REPLICATION_FAIL_INFLIGHT_REPLICATION) {
+ findSourceStrategy.addBackSourceDataNode(source);
+ }
Review Comment:
@Tejaskriya After scheduling the move here:
```
if (replicationManager.getConfig().isLegacyEnabled()) {
future = replicationManager
.move(containerID, source, moveSelection.getTargetNode());
} else {
future = moveManager.move(containerID, source,
moveSelection.getTargetNode());
}
```
this method will return true here if the move hasn't failed/completed yet:
```
moveSelectionToFutureMap.put(moveSelection, future);
return true;
```
Then, `updateTargetsAndSelectionCriteria` will eventually call
`findSourceStrategy.increaseSizeLeaving(source, size);`, which will add the
source datanode back so it can be considered in further move selections. So, we
don't need to add the source back in the asynchronous `whenComplete` handling
of the `future`.
--
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]