Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11759. Remove LegacyReplicationManager #7580

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.hadoop.hdds.scm.container.ContainerManager;
import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
import org.apache.hadoop.hdds.scm.container.ContainerReplica;
import org.apache.hadoop.hdds.scm.container.replication.LegacyReplicationManager;
import org.apache.hadoop.hdds.scm.container.replication.ReplicationManager;
import org.apache.hadoop.hdds.scm.node.NodeManager;
import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
Expand Down Expand Up @@ -143,18 +142,6 @@ private Comparator<ContainerID> orderContainersByUsedBytes() {
return this::isContainerMoreUsed;
}

/**
* Checks whether a Container has the ReplicationType
* {@link HddsProtos.ReplicationType#EC} and the Legacy Replication Manger is enabled.
* @param container container to check
* @return true if the ReplicationType is EC and "hdds.scm.replication
* .enable.legacy" is true, else false
*/
private boolean isECContainerAndLegacyRMEnabled(ContainerInfo container) {
return container.getReplicationType().equals(HddsProtos.ReplicationType.EC)
&& replicationManager.getConfig().isLegacyEnabled();
}

/**
* Gets containers that are suitable for moving based on the following
* required criteria:
Expand All @@ -163,7 +150,6 @@ private boolean isECContainerAndLegacyRMEnabled(ContainerInfo container) {
* 3. Container size should be closer to 5GB.
* 4. Container must not be in the configured exclude containers list.
* 5. Container should be closed.
* 6. If the {@link LegacyReplicationManager} is enabled, then the container should not be an EC container.
* @param node DatanodeDetails for which to find candidate containers.
* @return true if the container should be excluded, else false
*/
Expand All @@ -179,7 +165,7 @@ public boolean shouldBeExcluded(ContainerID containerID,
}
return excludeContainers.contains(containerID) || excludeContainersDueToFailure.contains(containerID) ||
containerToSourceMap.containsKey(containerID) ||
!isContainerClosed(container, node) || isECContainerAndLegacyRMEnabled(container) ||
!isContainerClosed(container, node) ||
isContainerReplicatingOrDeleting(containerID) ||
!findSourceStrategy.canSizeLeaveSource(node, container.getUsedBytes())
|| breaksMaxSizeToMoveLimit(container.containerID(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,18 +988,8 @@ private boolean moveContainer(DatanodeDetails source,
CompletableFuture<MoveManager.MoveResult> future;
try {
ContainerInfo containerInfo = containerManager.getContainer(containerID);
future = moveManager.move(containerID, source, moveSelection.getTargetNode());

/*
If LegacyReplicationManager is enabled, ReplicationManager will
redirect to it. Otherwise, use MoveManager.
*/
if (replicationManager.getConfig().isLegacyEnabled()) {
future = replicationManager
.move(containerID, source, moveSelection.getTargetNode());
} else {
future = moveManager.move(containerID, source,
moveSelection.getTargetNode());
}
metrics.incrementNumContainerMovesScheduledInLatestIteration(1);

future = future.whenComplete((result, ex) -> {
Expand Down Expand Up @@ -1038,7 +1028,7 @@ private boolean moveContainer(DatanodeDetails source,
selectionCriteria.addToExcludeDueToFailContainers(moveSelection.getContainerID());
metrics.incrementNumContainerMovesFailedInLatestIteration(1);
return false;
} catch (NodeNotFoundException | TimeoutException e) {
} catch (NodeNotFoundException e) {
LOG.warn("Container move failed for container {}", containerID, e);
metrics.incrementNumContainerMovesFailedInLatestIteration(1);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ default boolean isHealthy() {
|| containerState == HddsProtos.LifeCycleState.QUASI_CLOSED)
&& getReplicas().stream()
.filter(r -> r.getDatanodeDetails().getPersistedOpState() == IN_SERVICE)
.allMatch(r -> LegacyReplicationManager.compareState(
.allMatch(r -> ReplicationManager.compareState(
containerState, r.getState()));

}
Expand Down

This file was deleted.

Loading
Loading