浏览代码

HDDS-1754. getContainerWithPipeline fails with PipelineNotFoundException. Contributed by Supratim Deka (#1081)

supratimdeka 5 年之前
父节点
当前提交
738fab3bff

+ 8 - 0
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerInfo.java

@@ -467,4 +467,12 @@ public class ContainerInfo implements Comparator<ContainerInfo>,
     return state == HddsProtos.LifeCycleState.OPEN
         || state == HddsProtos.LifeCycleState.CLOSING;
   }
+
+  /**
+   * Check if a container is in Open state, but Close has not been initiated.
+   * @return true if Open, false otherwise.
+   */
+  public boolean isOpenNotClosing() {
+    return state == HddsProtos.LifeCycleState.OPEN;
+  }
 }

+ 1 - 1
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java

@@ -238,7 +238,7 @@ public class SCMClientProtocolServer implements
           getContainer(id);
       final Pipeline pipeline;
 
-      if (container.isOpen()) {
+      if (container.isOpenNotClosing()) {
         // Ratis pipeline
         pipeline = scm.getPipelineManager()
             .getPipeline(container.getPipelineID());