You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/01/08 23:19:25 UTC

[GitHub] [hadoop-ozone] hanishakoneru commented on a change in pull request #372: HDDS-2579. Ozone client should refresh pipeline info if reads from al…

hanishakoneru commented on a change in pull request #372: HDDS-2579. Ozone client should refresh pipeline info if reads from al…
URL: https://github.com/apache/hadoop-ozone/pull/372#discussion_r364478210
 
 

 ##########
 File path: hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
 ##########
 @@ -1031,7 +1032,33 @@ public OzoneInputStream readFile(String volumeName, String bucketName,
         .setSortDatanodesInPipeline(topologyAwareReadEnabled)
         .build();
     OmKeyInfo keyInfo = ozoneManagerClient.lookupFile(keyArgs);
-    return createInputStream(keyInfo);
+    return getInputStreamWithRetryFunction(keyInfo);
+  }
+
+  /**
+   * Create InputStream with Retry function to refresh pipeline information
+   * if reads fail.
+   * @param keyInfo
+   * @return
+   * @throws IOException
+   */
+  private OzoneInputStream getInputStreamWithRetryFunction(
+      OmKeyInfo keyInfo) throws IOException {
+    return createInputStream(keyInfo, omKeyInfo -> {
+      try {
+        OmKeyArgs omKeyArgs = new OmKeyArgs.Builder()
+            .setVolumeName(omKeyInfo.getVolumeName())
+            .setBucketName(omKeyInfo.getBucketName())
+            .setKeyName(omKeyInfo.getKeyName())
+            .setRefreshPipeline(true)
+            .setSortDatanodesInPipeline(topologyAwareReadEnabled)
+            .build();
+        return ozoneManagerClient.lookupKey(omKeyArgs);
+      } catch (IOException e) {
+        LOG.error("Unable to get key!");
 
 Review comment:
   Can we elaborate on the error message here saying that the unable to get key even after refresh pipeline or something. And also mention the keyName to help with debugging.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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