You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/08/03 00:45:57 UTC

[GitHub] [hadoop-ozone] xiaoyuyao commented on a change in pull request #1258: HDDS-4029. Recon unable to add a new container which is in CLOSED state.

xiaoyuyao commented on a change in pull request #1258:
URL: https://github.com/apache/hadoop-ozone/pull/1258#discussion_r464145469



##########
File path: hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconContainerManager.java
##########
@@ -86,12 +104,39 @@ public void testCheckAndAddNewContainer() throws IOException {
     ReconContainerManager containerManager = getContainerManager();
     assertFalse(containerManager.exists(containerID));
     DatanodeDetails datanodeDetails = randomDatanodeDetails();
-    containerManager.checkAndAddNewContainer(containerID, datanodeDetails);
+    containerManager.checkAndAddNewContainer(containerID,
+        OPEN, datanodeDetails);
     assertTrue(containerManager.exists(containerID));
 
     // Doing it one more time should not change any state.
-    containerManager.checkAndAddNewContainer(containerID, datanodeDetails);
+    containerManager.checkAndAddNewContainer(containerID, OPEN,
+        datanodeDetails);
     assertTrue(containerManager.exists(containerID));
+    assertEquals(LifeCycleState.OPEN,
+        getContainerManager().getContainer(containerID).getState());
   }
 
+  @Test
+  public void testUpdateContainerStateFromOpen() throws IOException {
+    ContainerWithPipeline containerWithPipeline =
+        getTestContainer(LifeCycleState.OPEN);
+
+    long id = containerWithPipeline.getContainerInfo().getContainerID();
+    ContainerID containerID =
+        containerWithPipeline.getContainerInfo().containerID();
+
+    // Adding container #100.
+    getContainerManager().addNewContainer(id, containerWithPipeline);
+    assertEquals(LifeCycleState.OPEN,
+        getContainerManager().getContainer(containerID).getState());
+
+    DatanodeDetails datanodeDetails = randomDatanodeDetails();
+
+    // First report with "CLOSED" replica state moves container state to
+    // "CLOSING".
+    getContainerManager().checkAndAddNewContainer(containerID, State.CLOSED,
+        datanodeDetails);
+    assertEquals(CLOSING,
+        getContainerManager().getContainer(containerID).getState());

Review comment:
       LGTM.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org