anuragp010 commented on code in PR #11399:
URL: https://github.com/apache/ozone/pull/11399#discussion_r4338936877
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/RatisUnderReplicationHandler.java:
##########
@@ -461,20 +466,39 @@ private List<DatanodeDetails> getTargets(
LOG.debug("UsedList: {}, size {}. ExcludeList: {}, size: {}. ",
used, used.size(), excluded, excluded.size());
- // TODO StoragePolicy replace this StorageType with container actual
StorageType
return ReplicationManagerUtil.getTargetDatanodes(placementPolicy,
replicaCount.additionalReplicaNeeded(), used, excluded,
- currentContainerSize, replicaCount.getContainer(),
StorageType.DEFAULT);
+ currentContainerSize, replicaCount.getContainer(), targetStorageType);
}
+ /**
+ * All Ratis replicas of a container are interchangeable, so the tier of any
+ * reported replica tells us where new copies belong.
+ *
+ * @return the storage type new replicas should use, or null when no replica
+ * reported one
+ */
+ private static StorageType targetStorageTypeFor(
+ List<ContainerReplica> replicas) {
+ return replicas.stream()
+ .map(ContainerReplica::getTargetStorageTypeForCopy)
+ .filter(Objects::nonNull)
+ .findFirst()
Review Comment:
`targetStorageTypeFor` takes the first non-null type among the replicas. If
the replicas are on different types, for example after one datanode's volume is
relabeled, the result depends on replica order. When the container is
under-replicated and the remaining replicas disagree, for example one on SSD
and one on DISK, what is the best way to choose the target type?
--
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]