snvijaya commented on a change in pull request #2464:
URL: https://github.com/apache/hadoop/pull/2464#discussion_r535129578



##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java
##########
@@ -141,7 +154,7 @@ public synchronized int read(final byte[] b, final int off, 
final int len) throw
     return totalReadBytes > 0 ? totalReadBytes : lastReadBytes;
   }
 
-  private int readOneBlock(final byte[] b, final int off, final int len) 
throws IOException {
+  private int validate(byte[] b, int off, int len) throws IOException {

Review comment:
       Returning int from validate which is used by caller as bytes read is 
wrong. Any failure in validate should return Boolean false and the caller in 
turn can convert it to -1 for bytes read.

##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java
##########
@@ -517,6 +527,14 @@ public int getWriteBufferSize() {
     return this.writeBufferSize;
   }
 
+  public boolean readSmallFilesCompletely() {

Review comment:
       In that case, skipping readAhead wont be ideal when reads are done by 
means of this optimizations. if 100 MB is set as buffer size, current logic is 
forcing a single server read request for 100 MB. 

##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java
##########
@@ -161,6 +174,14 @@ private int readOneBlock(final byte[] b, final int off, 
final int len) throws IO
     if (off < 0 || len < 0 || len > b.length - off) {
       throw new IndexOutOfBoundsException();
     }
+    return 1; // 1 indicate success
+  }
+
+  private int readOneBlock(final byte[] b, final int off, final int len) 
throws IOException {
+    int validation = validate(b, off, len);
+    if (validation < 1) {
+      return validation;

Review comment:
       see comment above




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
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