swamirishi commented on code in PR #3939:
URL: https://github.com/apache/ozone/pull/3939#discussion_r1023195251
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestECContainerRecovery.java:
##########
@@ -239,6 +254,96 @@ public void
testContainerRecoveryOverReplicationProcessing()
waitForContainerCount(5, container.containerID(), scm);
}
+ @Test
+ public void testECContainerRecoveryWithTimedOutRecovery() throws Exception {
+ byte[] inputData = getInputBytes(3);
+ final OzoneBucket bucket = getOzoneBucket();
+ String keyName = UUID.randomUUID().toString();
+ final Pipeline pipeline;
+ ECReplicationConfig repConfig =
+ new ECReplicationConfig(3, 2,
+ ECReplicationConfig.EcCodec.RS, chunkSize);
+ try (OzoneOutputStream out = bucket
+ .createKey(keyName, 1024, repConfig, new HashMap<>())) {
+ out.write(inputData);
+ pipeline = ((ECKeyOutputStream) out.getOutputStream())
+ .getStreamEntries().get(0).getPipeline();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ List<ContainerInfo> containers =
+ cluster.getStorageContainerManager().getContainerManager()
+ .getContainers();
+ ContainerInfo container = null;
+ for (ContainerInfo info : containers) {
+ if (info.getPipelineID().getId().equals(pipeline.getId().getId())) {
+ container = info;
+ }
+ }
+ StorageContainerManager scm = cluster.getStorageContainerManager();
+ AtomicReference<HddsDatanodeService> reconstructedDN =
+ new AtomicReference<>();
+ ContainerInfo finalContainer = container;
+ Map<HddsDatanodeService, Long> recoveryTimeoutMap = new HashMap<>();
+ for (HddsDatanodeService dn : cluster.getHddsDatanodes()) {
+ recoveryTimeoutMap.put(dn, dn.getDatanodeStateMachine().getContainer()
+ .getContainerSet().getRecoveringTimeout());
+ dn.getDatanodeStateMachine().getContainer()
+ .getContainerSet().setRecoveringTimeout(100);
+
+ ECReconstructionSupervisor ecReconstructionSupervisor =
+ GenericTestUtils.getFieldReflection(dn.getDatanodeStateMachine(),
+ "ecReconstructionSupervisor");
+ ECReconstructionCoordinator coordinator = GenericTestUtils
+ .mockFieldReflection(ecReconstructionSupervisor,
+ "reconstructionCoordinator");
+
+ Mockito.doAnswer(invocation -> {
+ GenericTestUtils.waitFor(() ->
+ dn.getDatanodeStateMachine()
+ .getContainer()
+ .getContainerSet()
+ .getContainer(finalContainer.getContainerID())
+ .getContainerState() ==
+ ContainerProtos.ContainerDataProto.State.UNHEALTHY,
+ 1000, 100000);
+ reconstructedDN.set(dn);
+ invocation.callRealMethod();
+ return null;
+ }).when(coordinator).reconstructECBlockGroup(Mockito.any(),
Mockito.any(),
+ Mockito.any());
+ }
+
Review Comment:
Here I am recreating the scenario of reconstruction failing because of
deletion & the container not existing in the datanode. Separate unit test cases
exist for recovery container being created and getting marked unhealthy &
writes on unhealthy failing.
--
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]