You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/10/25 14:28:42 UTC

[GitHub] [ozone] swamirishi commented on a diff in pull request #3836: HDDS-6966. EC: Handle the placement policy satisfaction in HealthChecks handling

swamirishi commented on code in PR #3836:
URL: https://github.com/apache/ozone/pull/3836#discussion_r1004565273


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -353,8 +386,77 @@ private void processMaintenanceOnlyIndexes(
         DatanodeDetails target = iterator.next();
         commands.put(target, replicateCommand);
         additionalMaintenanceCopiesNeeded -= 1;
+        maintIndexes.remove(replica.getReplicaIndex());
+        createdIndexes.add(replica.getReplicaIndex());
+      }
+    }
+  }
+
+  /**
+   * Function processes Replicas to fix placement policy issues.
+   * @param replicas
+   * @param deletionInFlight
+   * @param container
+   * @param excludedNodes
+   * @param sources
+   * @param createdIndexes
+   * @param placementStatus
+   * @throws IOException
+   */
+  private Map<DatanodeDetails, SCMCommand<?>> processMisreplication(
+          Set<ContainerReplica> replicas,
+          List<DatanodeDetails> deletionInFlight, ContainerInfo container,
+          List<DatanodeDetails> excludedNodes,
+          Map<Integer, Pair<ContainerReplica, NodeStatus>> sources,
+          Set<Integer> createdIndexes, ContainerPlacementStatus placementStatus)
+          throws IOException {
+    if (placementStatus.isPolicySatisfied() ||
+            placementStatus.misReplicationCount() <= createdIndexes.size()) {
+      return Collections.emptyMap();
+    }
+    Map<DatanodeDetails, SCMCommand<?>> commands = new HashMap<>();
+    List<Integer> sortedReplicaIdx =
+            getSourcesStream(replicas, deletionInFlight)
+                    .collect(Collectors.groupingBy(
+                            r -> r.getLeft().getReplicaIndex(),
+                            Collectors.counting()))
+                    .entrySet().stream()
+                    .sorted(Comparator.comparingLong(Map.Entry::getValue))
+                    .map(Map.Entry::getKey).collect(Collectors.toList());
+    int additionalCopiesForPlacementStatus =
+            placementStatus.misReplicationCount() - createdIndexes.size();
+    List<DatanodeDetails> targets = getTargetDatanodes(excludedNodes, container,

Review Comment:
   This is taken care by the rack scatter policy which would fail if the selection doesn't conform to the policy



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org