jojochuang commented on code in PR #11450:
URL: https://github.com/apache/ozone/pull/11450#discussion_r4239965199
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -427,72 +484,116 @@ private int processDecommissioningIndexes(
throws IOException {
ContainerInfo container = replicaCount.getContainer();
Set<Integer> decomIndexes = replicaCount.decommissioningOnlyIndexes(true);
- int commandsSent = 0;
- if (!decomIndexes.isEmpty()) {
- LOG.debug("Processing decommissioning indexes {} for container {}.",
- decomIndexes, container.containerID());
- final List<DatanodeDetails> selectedDatanodes = getTargetDatanodes(
- container, decomIndexes.size(), usedNodes, excludedNodes);
-
- ContainerPlacementStatus placementStatusWithSelectedTargets =
- validatePlacement(container, availableSourceNodes,
selectedDatanodes);
- if (!placementStatusWithSelectedTargets.isPolicySatisfied()) {
- LOG.debug("Target nodes + existing nodes for EC container {}" +
- " will not satisfy placement policy {}. Reason: {}. Selected" +
- " nodes: {}. Available source nodes: {}. Resuming recovery " +
- "regardless.",
- container.containerID(), containerPlacement.getClass().getName(),
- placementStatusWithSelectedTargets.misReplicatedReason(),
- selectedDatanodes, availableSourceNodes);
- }
+ if (decomIndexes.isEmpty()) {
+ return 0;
+ }
- usedNodes.addAll(selectedDatanodes);
- Iterator<DatanodeDetails> iterator = selectedDatanodes.iterator();
- // In this case we need to do one to one copy.
- CommandTargetOverloadedException overloadedException = null;
- for (Integer decomIndex : decomIndexes) {
- Pair<ContainerReplica, NodeStatus> source = sources.get(decomIndex);
- if (source == null) {
- LOG.warn("Cannot find source replica for decommissioning index " +
- "{} in container {}", decomIndex, container.containerID());
+ if
(replicationManager.getConfig().isEcDecommissionReconstructionEnabled()) {
+ ECReplicationConfig repConfig =
+ (ECReplicationConfig) container.getReplicationConfig();
+ for (Integer index : decomIndexes) {
+ Pair<ContainerReplica, NodeStatus> source = sources.get(index);
+ if (source == null || !replicationManager.isNodeHighlyLoaded(
+ source.getLeft().getDatanodeDetails())) {
continue;
}
- ContainerReplica sourceReplica = source.getLeft();
- if (!iterator.hasNext()) {
- LOG.warn("Couldn't find enough targets. Available source"
- + " nodes: {}, the target nodes: {}, excluded nodes: {},"
- + " usedNodes: {}, and the decommission indexes: {}",
- sources.values().stream()
- .map(Pair::getLeft).collect(Collectors.toSet()),
- selectedDatanodes, excludedNodes, usedNodes, decomIndexes);
+ if (!hasSufficientSourcesForDecommissionReconstruction(
+ sources, decomIndexes, repConfig.getData())) {
+ LOG.debug("Insufficient non-decommission sources to reconstruct "
+ + "decommission indexes for container {}, using 1-1 "
+ + "replication.",
+ container.containerID());
break;
}
+ if (replicationManager.isReconstructionLimitReached()) {
+ LOG.debug("Global reconstruction limit reached for container {}, "
+ + "using 1-1 replication for decommission recovery.",
+ container.containerID());
+ break;
+ }
+ LOG.info("Source node {} is highly loaded, switching to "
+ + "reconstruction for decommissioning container {}",
+ source.getLeft().getDatanodeDetails(), container.containerID());
try {
- createReplicateCommand(
- container, iterator, sourceReplica, replicaCount);
- commandsSent++;
+ int commandsSent = processReconstruction(replicaCount,
+ new ArrayList<>(decomIndexes), sources, availableSourceNodes,
+ excludedNodes, usedNodes);
Review Comment:
Fixed in 862313e. `usedNodes` / `availableSourceNodes` are updated only
after `sendThrottledReconstructionCommand` succeeds. Added
`testUnderReplicationWithDecomNodesFallsBackWhenReconstructionThrottledOneTarget`
(PlacementPolicySpy with a single spare target) to ensure throttled recon
still allows 1-1 copy placement.
--
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]