[ 
https://issues.apache.org/jira/browse/HADOOP-17770?focusedWorklogId=621072&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-621072
 ]

ASF GitHub Bot logged work on HADOOP-17770:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Jul/21 17:05
            Start Date: 09/Jul/21 17:05
    Worklog Time Spent: 10m 
      Work Description: anoopsjohn commented on a change in pull request #3149:
URL: https://github.com/apache/hadoop/pull/3149#discussion_r667094175



##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java
##########
@@ -915,6 +922,33 @@ public synchronized int read(byte[] b, int off, int len) 
throws FileNotFoundExce
       }
     }
 
+    @Override
+    public int read(long position, byte[] buffer, int offset, int length)
+        throws IOException {
+      if (in instanceof PositionedReadable) {
+        try {
+          int result = ((PositionedReadable) this.in).read(position, buffer,
+              offset, length);
+          if (null != statistics && result > 0) {
+            statistics.incrementBytesRead(result);
+          }
+          return result;
+        } catch (IOException e) {
+          Throwable innerException = 
NativeAzureFileSystemHelper.checkForAzureStorageException(e);
+          if (innerException instanceof StorageException) {
+            LOG.error("Encountered Storage Exception for read on Blob : {}"
+                + " Exception details: {} Error Code : {}",
+                key, e, ((StorageException) innerException).getErrorCode());
+            if 
(NativeAzureFileSystemHelper.isFileNotFoundException((StorageException) 
innerException)) {
+              throw new FileNotFoundException(String.format("%s is not found", 
key));
+            }
+          }
+          throw e;
+        }
+      }
+      return super.read(position, buffer, offset, length);

Review comment:
       Before this patch it happen this way.
   FSInputStream.read(long, byte[], int, int)
   You are right that FSInputStream pread API do relative read.  But in finally 
it seek back to original pos
   ya after this patch the 'in' will be PositionedReadable for sure.  But I 
think we should keep this generic way
   If here 'in' is PositionedReadable make use of that pread API or else 
fallback to old way




-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 621072)
    Time Spent: 50m  (was: 40m)

> WASB : Support disabling buffered reads in positional reads
> -----------------------------------------------------------
>
>                 Key: HADOOP-17770
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17770
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>         Attachments: AvgLatency_0 cache hit.png, AvgLatency_50% cache 
> hit.png, Throughput_0 cache hit.png, Throughput_50% cache hit.png
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> This is just like HADOOP-17038
> Right now it will do a seek to the position , read and then seek back to the 
> old position. (As per the impl in the super class)
> In HBase kind of workloads we rely mostly on short preads. (like 64 KB size 
> by default). So would be ideal to support a pure pos read API which will not 
> even keep the data in a buffer but will only read the required data as what 
> is asked for by the caller. (Not reading ahead more data as per the read size 
> config)
> Allow an optional boolean config to be specified while opening file for read 
> using which buffered pread can be disabled.
> FutureDataInputStreamBuilder openFile(Path path)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to