anuragp010 commented on code in PR #12185:
URL: https://github.com/apache/ozone/pull/12185#discussion_r4740584542
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -699,21 +700,66 @@ private int processMaintenanceOnlyIndexes(
private void createReplicateCommand(
ContainerInfo container, Iterator<DatanodeDetails> iterator,
- ContainerReplica replica, ECContainerReplicaCount replicaCount)
+ ContainerReplica replica, ECContainerReplicaCount replicaCount,
StorageType targetStorageType)
throws CommandTargetOverloadedException, NotLeaderException {
DatanodeDetails source = replica.getDatanodeDetails();
DatanodeDetails target = iterator.next();
replicationManager.sendThrottledReplicationCommand(
container, Collections.singletonList(source), target,
- replica.getReplicaIndex());
- adjustPendingOps(replicaCount, target, replica.getReplicaIndex());
+ replica.getReplicaIndex(), targetStorageType);
+ adjustPendingOps(replicaCount, target, replica.getReplicaIndex(),
targetStorageType);
}
private void adjustPendingOps(ECContainerReplicaCount replicaCount,
- DatanodeDetails target, int replicaIndex) {
+ DatanodeDetails target, int replicaIndex,
StorageType targetStorageType) {
replicaCount.addPendingOp(new ContainerReplicaOp(
ContainerReplicaOp.PendingOpType.ADD, target, replicaIndex, null,
- Long.MAX_VALUE, 0, null));
+ Long.MAX_VALUE, 0, targetStorageType));
+ }
+
+ /**
+ * Selects copy targets of the container's storage tier, falling back the
same way RATIS repair does: on
+ * FAILED_TO_FIND_SUITABLE_NODE, retry with {@link
ReplicationManagerUtil#getFallbackStorageType} (SSD to DISK;
+ * others have no fallback). A container with no tier resolves to {@link
StorageType#DEFAULT}.
+ */
+ private TargetSelection selectCopyTargetsWithFallback(ContainerInfo
container, int requiredNodes,
Review Comment:
nit: This target selection logic with fallback is duplicated in
`RatisUnderReplicationHandler` and `QuasiClosedStuckUnderReplicationHandler`.
Could we extract it into a common method, perhaps in `ReplicationManagerUtil`?
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -635,9 +636,9 @@ private int processMaintenanceOnlyIndexes(
LOG.debug("Number of maintenance replicas of container {} that need " +
"additional copies: {}.", container.containerID(),
additionalMaintenanceCopiesNeeded);
- // TODO StoragePolicy replace this StorageType with container actual
StorageType
- List<DatanodeDetails> targets = getTargetDatanodes(
- container, maintIndexes.size(), usedNodes, excludedNodes,
StorageType.DEFAULT);
+ final TargetSelection maintTargets = selectCopyTargetsWithFallback(
+ container, maintIndexes.size(), usedNodes, excludedNodes);
+ List<DatanodeDetails> targets = maintTargets.targets();
Review Comment:
The maintenance path is not currently covered by storage-type tests.
`processMaintenanceOnlyIndexes` has its own `selectCopyTargetsWithFallback` and
`createReplicateCommand(...,maintTargets.storageType())` calls, so the
decommission tests do not exercise it. Could we add a maintenance version of
`testDecommissionCopyPreservesStorageTier`?
--
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]