You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "kerneltime (via GitHub)" <gi...@apache.org> on 2023/03/08 20:02:56 UTC

[GitHub] [ozone] kerneltime commented on a diff in pull request #4363: HDDS-8108. gRPC channel created for replication client not shutdown properly

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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org