You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/07/09 16:49:00 UTC

[jira] [Work logged] (HADOOP-17770) WASB : Support disabling buffered reads in positional reads

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

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

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



##########
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:
       I think if "in" is not PositionedReadable steam then we should throw exception. We shouldn't change the meaning of read() API by calling super.read().
   
   **FSInputStream.read(long, byte[], int, int)** internally call **read(byte[], int, int)**, which is not positioned read API. This will change the current offset of a file.
   




-- 
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-unsubscribe@hadoop.apache.org

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


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

    Worklog Id:     (was: 621065)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org