瀏覽代碼

HDDS-305. Datanode StateContext#addContainerActionIfAbsent will add container action even if there already is a ContainerAction. Contributed by Nanda kumar.

Nanda kumar 6 年之前
父節點
當前提交
7631e0adae

+ 1 - 12
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java

@@ -168,19 +168,8 @@ public class HddsDispatcher implements ContainerDispatcher {
       double containerUsedPercentage = 1.0f * containerData.getBytesUsed() /
           StorageUnit.GB.toBytes(containerData.getMaxSizeGB());
       if (containerUsedPercentage >= containerCloseThreshold) {
-
-        ContainerInfo containerInfo = ContainerInfo.newBuilder()
-            .setContainerID(containerData.getContainerID())
-            .setReadCount(containerData.getReadCount())
-            .setWriteCount(containerData.getWriteCount())
-            .setReadBytes(containerData.getReadBytes())
-            .setWriteBytes(containerData.getWriteBytes())
-            .setUsed(containerData.getBytesUsed())
-            .setState(HddsProtos.LifeCycleState.OPEN)
-            .build();
-
         ContainerAction action = ContainerAction.newBuilder()
-            .setContainer(containerInfo)
+            .setContainerID(containerData.getContainerID())
             .setAction(ContainerAction.Action.CLOSE)
             .setReason(ContainerAction.Reason.CONTAINER_FULL)
             .build();

+ 1 - 1
hadoop-hdds/container-service/src/main/proto/StorageContainerDatanodeProtocol.proto

@@ -157,7 +157,7 @@ message ContainerAction {
     CONTAINER_FULL = 1;
   }
 
-  required ContainerInfo container = 1;
+  required int64 containerID = 1;
   required Action action = 2;
   optional Reason reason = 3;
 }

+ 1 - 4
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/states/endpoint/TestHeartbeatEndpointTask.java

@@ -289,10 +289,7 @@ public class TestHeartbeatEndpointTask {
 
   private ContainerAction getContainerAction() {
     ContainerAction.Builder builder = ContainerAction.newBuilder();
-    ContainerInfo containerInfo = ContainerInfo.newBuilder()
-        .setContainerID(1L)
-        .build();
-    builder.setContainer(containerInfo)
+    builder.setContainerID(1L)
         .setAction(ContainerAction.Action.CLOSE)
         .setReason(ContainerAction.Reason.CONTAINER_FULL);
     return builder.build();