Source:
private void handleException(BlockOutputStreamEntry streamEntry, IOException exception) throws IOException { Throwable t = HddsClientUtils.checkForException(exception); boolean retryFailure = checkForRetryFailure(t); boolean closedContainerException = false; if (!retryFailure) { closedContainerException = checkIfContainerIsClosed(t); } Pipeline pipeline = streamEntry.getPipeline(); PipelineID pipelineId = streamEntry.getPipeline().getId(); long totalSuccessfulFlushedData = streamEntry.getTotalAckDataLength(); streamEntry.setCurrentPosition(totalSuccessfulFlushedData); long bufferedDataLen = blockOutputStreamEntryPool.computeBufferData(); if (closedContainerException) { LOG.debug( "Encountered exception {}. The last committed block length is {}, " + "uncommitted data length is retry count {}", exception, totalSuccessfulFlushedData, bufferedDataLen, retryCount); } else { LOG.info( "Encountered exception on the pipeline {}. The last committed block length is {}, " + "uncommitted data length is retry count {}", exception, pipeline, totalSuccessfulFlushedData, bufferedDataLen, retryCount); } Preconditions.checkArgument( bufferedDataLen <= blockOutputStreamEntryPool.getStreamBufferMaxSize()); Preconditions.checkArgument( offset - blockOutputStreamEntryPool.getKeyLength() == bufferedDataLen); long containerId = streamEntry.getBlockID().getContainerID(); Collection<DatanodeDetails> failedServers = streamEntry.getFailedServers(); Preconditions.checkNotNull(failedServers); ExcludeList excludeList = blockOutputStreamEntryPool.getExcludeList(); if (!failedServers.isEmpty()) { excludeList.addDatanodes(failedServers); } if (closedContainerException) { excludeList.addConatinerId(ContainerID.valueof(containerId)); } else if (retryFailure || t instanceof TimeoutException || t instanceof GroupMismatchException || t instanceof NotReplicatedException) { excludeList.addPipeline(pipelineId); } streamEntry.cleanup(retryFailure); if (closedContainerException) { blockOutputStreamEntryPool .discardPreallocatedBlocks(streamEntry.getBlockID().getContainerID(), null); } else { blockOutputStreamEntryPool .discardPreallocatedBlocks(-1, pipelineId); } if (bufferedDataLen > 0) { handleRetry(exception, bufferedDataLen); retryCount = 0; } }

Target:
private void handleException(BlockOutputStreamEntry streamEntry, IOException exception) throws IOException { Throwable t = HddsClientUtils.checkForException(exception); boolean retryFailure = checkForRetryFailure(t); boolean closedContainerException = false; if (!retryFailure) { closedContainerException = checkIfContainerIsClosed(t); } Pipeline pipeline = streamEntry.getPipeline(); PipelineID pipelineId = pipeline.getId(); long totalSuccessfulFlushedData = streamEntry.getTotalAckDataLength(); streamEntry.setCurrentPosition(totalSuccessfulFlushedData); long bufferedDataLen = blockOutputStreamEntryPool.computeBufferData(); if (closedContainerException) { LOG.debug( "Encountered exception {}. The last committed block length is {}, " + "uncommitted data length is retry count {}", exception, totalSuccessfulFlushedData, bufferedDataLen, retryCount); } else { LOG.warn( "Encountered exception on the pipeline {}. " + "The last committed block length is {}, " + "uncommitted data length is retry count {}", exception, pipeline, totalSuccessfulFlushedData, bufferedDataLen, retryCount); } Preconditions.checkArgument( bufferedDataLen <= blockOutputStreamEntryPool.getStreamBufferMaxSize()); Preconditions.checkArgument( offset - blockOutputStreamEntryPool.getKeyLength() == bufferedDataLen); long containerId = streamEntry.getBlockID().getContainerID(); Collection<DatanodeDetails> failedServers = streamEntry.getFailedServers(); Preconditions.checkNotNull(failedServers); ExcludeList excludeList = blockOutputStreamEntryPool.getExcludeList(); if (!failedServers.isEmpty()) { excludeList.addDatanodes(failedServers); } if (closedContainerException) { excludeList.addConatinerId(ContainerID.valueof(containerId)); } else if (retryFailure || t instanceof TimeoutException || t instanceof GroupMismatchException || t instanceof NotReplicatedException) { excludeList.addPipeline(pipelineId); } streamEntry.cleanup(retryFailure); if (closedContainerException) { blockOutputStreamEntryPool .discardPreallocatedBlocks(streamEntry.getBlockID().getContainerID(), null); } else { blockOutputStreamEntryPool .discardPreallocatedBlocks(-1, pipelineId); } if (bufferedDataLen > 0) { handleRetry(exception, bufferedDataLen); retryCount = 0; } }