Source:
public void test2WayCommitForRetryfailure() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.setTimeDuration( OzoneConfigKeys.OZONE_CLIENT_WATCH_REQUEST_TIMEOUT, 20, TimeUnit.SECONDS); conf.setInt( OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_MAX_RETRIES_KEY, 20); conf.setInt( ScmConfigKeys.OZONE_DATANODE_MAX_PIPELINE_ENGAGEMENT, 0); startCluster(conf); GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.captureLogs(XceiverClientRatis.LOG); XceiverClientManager clientManager = new XceiverClientManager(conf); ContainerWithPipeline container1 = storageContainerLocationClient .allocateContainer(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, containerOwner); XceiverClientSpi xceiverClient = clientManager .acquireClient(container1.getPipeline()); Assert.assertEquals(1, xceiverClient.getRefcount()); Assert.assertEquals(container1.getPipeline(), xceiverClient.getPipeline()); Pipeline pipeline = xceiverClient.getPipeline(); XceiverClientRatis ratisClient = (XceiverClientRatis) xceiverClient; XceiverClientReply reply = xceiverClient.sendCommandAsync( ContainerTestHelper.getCreateContainerRequest( container1.getContainerInfo().getContainerID(), xceiverClient.getPipeline())); reply.getResponse().get(); Assert.assertEquals(3, ratisClient.getCommitInfoMap().size()); cluster.shutdownHddsDatanode(pipeline.getNodes().get(0)); reply = xceiverClient.sendCommandAsync(ContainerTestHelper .getCloseContainer(pipeline, container1.getContainerInfo().getContainerID())); reply.getResponse().get(); xceiverClient.watchForCommit(reply.getLogIndex(), 20000); Assert.assertEquals(2, ratisClient.getCommitInfoMap().size()); clientManager.releaseClient(xceiverClient, false); Assert.assertTrue(logCapturer.getOutput().contains("3 way commit failed")); Assert .assertTrue(logCapturer.getOutput().contains("Committed by majority")); logCapturer.stopCapturing(); shutdown(); }

Target:
public void test2WayCommitForRetryfailure() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.setTimeDuration(OzoneConfigKeys.OZONE_CLIENT_WATCH_REQUEST_TIMEOUT, 20, TimeUnit.SECONDS); conf.setInt(OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_MAX_RETRIES_KEY, 20); startCluster(conf); GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.captureLogs(XceiverClientRatis.LOG); XceiverClientManager clientManager = new XceiverClientManager(conf); ContainerWithPipeline container1 = storageContainerLocationClient .allocateContainer(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, containerOwner); XceiverClientSpi xceiverClient = clientManager .acquireClient(container1.getPipeline()); Assert.assertEquals(1, xceiverClient.getRefcount()); Assert.assertEquals(container1.getPipeline(), xceiverClient.getPipeline()); Pipeline pipeline = xceiverClient.getPipeline(); XceiverClientRatis ratisClient = (XceiverClientRatis) xceiverClient; XceiverClientReply reply = xceiverClient.sendCommandAsync( ContainerTestHelper.getCreateContainerRequest( container1.getContainerInfo().getContainerID(), xceiverClient.getPipeline())); reply.getResponse().get(); Assert.assertEquals(3, ratisClient.getCommitInfoMap().size()); cluster.shutdownHddsDatanode(pipeline.getNodes().get(0)); reply = xceiverClient.sendCommandAsync(ContainerTestHelper .getCloseContainer(pipeline, container1.getContainerInfo().getContainerID())); reply.getResponse().get(); xceiverClient.watchForCommit(reply.getLogIndex(), 20000); Assert.assertEquals(2, ratisClient.getCommitInfoMap().size()); clientManager.releaseClient(xceiverClient, false); Assert.assertTrue(logCapturer.getOutput().contains("3 way commit failed")); Assert .assertTrue(logCapturer.getOutput().contains("Committed by majority")); logCapturer.stopCapturing(); shutdown(); }