kerneltime commented on code in PR #4363:
URL: https://github.com/apache/ozone/pull/4363#discussion_r1129963806
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java:
##########
@@ -72,28 +72,36 @@ public Path getContainerDataFromReplicas(
shuffleDatanodes(sourceDatanodes);
for (DatanodeDetails datanode : shuffledDatanodes) {
+ GrpcReplicationClient client = null;
try {
+ client = createReplicationClient(datanode, compression);
CompletableFuture<Path> result =
- downloadContainer(containerId, datanode, downloadDir, compression);
+ downloadContainer(client, containerId, downloadDir);
return result.get();
- } catch (ExecutionException | IOException e) {
- LOG.error("Error on replicating container: {} from {}/{}", containerId,
- datanode.getHostName(), datanode.getIpAddress(), e);
} catch (InterruptedException e) {
+ logError(e, containerId, datanode);
Thread.currentThread().interrupt();
- } catch (Exception ex) {
- LOG.error("Container {} download from datanode {} was unsuccessful. "
- + "Trying the next datanode", containerId, datanode, ex);
+ } catch (Exception e) {
+ logError(e, containerId, datanode);
+ } finally {
+ IOUtils.close(LOG, client);
}
}
LOG.error("Container {} could not be downloaded from any datanode",
containerId);
return null;
}
+ private static void logError(Exception e,
+ long containerId, DatanodeDetails datanode) {
+ LOG.error("Error on replicating container: {} from {}", containerId,
Review Comment:
Nit: Functions that log error should be inlined even if duplicated.
--
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]