Repository: hadoop Updated Branches: refs/heads/trunk 90e2e493b -> 2a5d4315b
HDDS-551. Fix the close container status check in CloseContainerCommandHandler. Contributed by Shashikant Banerjee. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2a5d4315 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2a5d4315 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2a5d4315 Branch: refs/heads/trunk Commit: 2a5d4315bfe13c12cacc7718537077bf9abb22e2 Parents: 90e2e49 Author: Hanisha Koneru <[email protected]> Authored: Thu Sep 27 16:03:49 2018 -0700 Committer: Hanisha Koneru <[email protected]> Committed: Thu Sep 27 16:03:49 2018 -0700 ---------------------------------------------------------------------- .../commandhandler/CloseContainerCommandHandler.java | 11 +++++++++++ .../hadoop/ozone/container/ozoneimpl/OzoneContainer.java | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a5d4315/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java index d4e13ee..0af591b 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java @@ -74,6 +74,17 @@ public class CloseContainerCommandHandler implements CommandHandler { CloseContainerCommandProto .parseFrom(command.getProtoBufMessage()); containerID = closeContainerProto.getContainerID(); + if (container.getContainerSet().getContainer(containerID) + .getContainerData().isClosed()) { + LOG.debug("Container {} is already closed", containerID); + // It might happen that the where the first attempt of closing the + // container failed with NOT_LEADER_EXCEPTION. In such cases, SCM will + // retry to check the container got really closed via Ratis. + // In such cases of the retry attempt, if the container is already + // closed via Ratis, we should just return. + cmdExecuted = true; + return; + } HddsProtos.PipelineID pipelineID = closeContainerProto.getPipelineID(); HddsProtos.ReplicationType replicationType = closeContainerProto.getReplicationType(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a5d4315/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java index da58772..503112d 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java @@ -188,15 +188,6 @@ public class OzoneContainer { ContainerProtos.ContainerCommandRequestProto request, ReplicationType replicationType, PipelineID pipelineID) throws IOException { - if (containerSet.getContainer(request.getContainerID()) - .getContainerData().isClosed()) { - LOG.debug("Container {} is already closed", request.getContainerID()); - // It might happen that the where the first attempt of closing the - // container failed with NOT_LEADER_EXCEPTION. In such cases, SCM will - // retry to check the container got really closed via Ratis. - // In such cases of the retry attempt, if the container is already closed - // via Ratis, we should just return. - } LOG.info("submitting {} request over {} server for container {}", request.getCmdType(), replicationType, request.getContainerID()); Preconditions.checkState(servers.containsKey(replicationType)); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
