kerneltime commented on a change in pull request #2989:
URL: https://github.com/apache/ozone/pull/2989#discussion_r786409843



##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestContainerStateMachineFailures.java
##########
@@ -677,4 +682,133 @@ public void 
testWriteStateMachineDataIdempotencyWithClosedContainer()
 
     r2.run();
   }
+
+  @Test
+  public void testContainerStateMachineSingleFailureRetry()
+      throws Exception {
+    OzoneOutputStream key =
+        objectStore.getVolume(volumeName).getBucket(bucketName)
+            .createKey("ratis1", 1024, ReplicationType.RATIS,
+                ReplicationFactor.THREE, new HashMap<>());
+
+    key.write("ratis".getBytes(UTF_8));
+    key.flush();
+    key.write("ratis".getBytes(UTF_8));
+    key.write("ratis".getBytes(UTF_8));
+
+    KeyOutputStream groupOutputStream = (KeyOutputStream) key.
+        getOutputStream();
+    List<OmKeyLocationInfo> locationInfoList =
+        groupOutputStream.getLocationInfoList();
+    Assert.assertEquals(1, locationInfoList.size());
+
+    OmKeyLocationInfo omKeyLocationInfo = locationInfoList.get(0);
+
+    Set<HddsDatanodeService> datanodeSet =
+        TestHelper.getDatanodeServices(cluster,
+            omKeyLocationInfo.getPipeline());
+
+    UUID leader = omKeyLocationInfo.getPipeline().getLeaderId();
+    for (HddsDatanodeService dn : datanodeSet) {
+      UUID dnUuid = dn.getDatanodeDetails().getUuid();
+      if (!dnUuid.equals(leader)) {
+        ContainerData containerData =
+            dn.getDatanodeStateMachine()
+                .getContainer().getContainerSet()
+                .getContainer(omKeyLocationInfo.getContainerID())
+                .getContainerData();
+        Assert.assertTrue(containerData instanceof KeyValueContainerData);
+        KeyValueContainerData keyValueContainerData =
+            (KeyValueContainerData) containerData;
+        FileUtil.fullyDelete(new File(keyValueContainerData.getChunksPath()));
+        break;
+      }
+    }
+    try {
+      key.close();
+    } catch (Exception ioe) {
+      // Should not fail..
+      Assert.fail("Exception " + ioe.getMessage());
+    }
+    validateData("ratis1", 2, "ratisratisratis");
+  }
+
+  @Test
+  public void testContainerStateMachineDualFailureRetry()

Review comment:
       Will do.
   The expected is 2 in this specific targeted case. It is possible to have 
more than 2 in a real production failure sequence but in a controlled test 
environment it would be 2.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to