This is an automated email from the ASF dual-hosted git repository.

sodonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 33146d5d62 HDDS-9289. LOG improvement when downloading container fails 
from DN (#5316)
33146d5d62 is described below

commit 33146d5d62ee20258a35e10506be1e70a67e2df4
Author: DaveTeng0 <[email protected]>
AuthorDate: Wed Sep 20 09:37:03 2023 -0700

    HDDS-9289. LOG improvement when downloading container fails from DN (#5316)
---
 .../replication/SimpleContainerDownloader.java          | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
index cf7ff211bf..a3a975f1bd 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
@@ -71,7 +71,8 @@ public class SimpleContainerDownloader implements 
ContainerDownloader {
     final List<DatanodeDetails> shuffledDatanodes =
         shuffleDatanodes(sourceDatanodes);
 
-    for (DatanodeDetails datanode : shuffledDatanodes) {
+    for (int i = 0; i < shuffledDatanodes.size(); i++) {
+      DatanodeDetails datanode = shuffledDatanodes.get(i);
       GrpcReplicationClient client = null;
       try {
         client = createReplicationClient(datanode, compression);
@@ -79,10 +80,10 @@ public class SimpleContainerDownloader implements 
ContainerDownloader {
             downloadContainer(client, containerId, downloadDir);
         return result.get();
       } catch (InterruptedException e) {
-        logError(e, containerId, datanode);
+        logError(e, containerId, datanode, i, shuffledDatanodes.size());
         Thread.currentThread().interrupt();
       } catch (Exception e) {
-        logError(e, containerId, datanode);
+        logError(e, containerId, datanode, i, shuffledDatanodes.size());
       } finally {
         IOUtils.close(LOG, client);
       }
@@ -93,8 +94,14 @@ public class SimpleContainerDownloader implements 
ContainerDownloader {
   }
 
   private static void logError(Exception e,
-      long containerId, DatanodeDetails datanode) {
-    LOG.error("Error on replicating container: {} from {}", containerId,
+      long containerId, DatanodeDetails datanode, int datanodeIndex,
+      int shuffledDatanodesSize) {
+    StringBuilder sb =
+        new StringBuilder("Error on replicating container: {} from {}. ");
+    if (datanodeIndex < shuffledDatanodesSize - 1) {
+      sb.append("Will try next datanode.");
+    }
+    LOG.error(sb.toString(), containerId,
         datanode, e);
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to