You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ha...@apache.org on 2018/09/27 23:04:05 UTC

hadoop git commit: HDDS-551. Fix the close container status check in CloseContainerCommandHandler. Contributed by Shashikant Banerjee.

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 <ha...@apache.org>
Authored: Thu Sep 27 16:03:49 2018 -0700
Committer: Hanisha Koneru <ha...@apache.org>
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: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org