[ 
https://issues.apache.org/jira/browse/HDDS-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609619#comment-16609619
 ] 

Xiaoyu Yao edited comment on HDDS-419 at 9/10/18 6:08 PM:
----------------------------------------------------------

Thanks [~msingh] for reporting the issue and posting the fix. The fix looks 
good with the new test added but it hides a latent bug in 
ChunkGroupInputStream#read(). I propose to fix it there like below without 
changing OzoneInputStream, let me know your thoughts. 
{code:java}
 

*--- 
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java*

*+++ 
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java*

@@ -122,12 +122,8 @@ public synchronized int read(byte[] b, int off, int len) 
throws IOException {

         return totalReadLen > 0 ? totalReadLen : EOF;

       }

       totalReadLen += actualLen;

-      // this means there is no more data to read beyond this point, return

-      if (actualLen != readLen) {

-        return totalReadLen;

-      }

-      off += readLen;

-      len -= readLen;

+      off += actualLen;

+      len -= actualLen;

       if (current.getRemaining() <= 0) {

         currentStreamIndex += 1;

       }

{code}


was (Author: xyao):
Thanks [~msingh] for reporting the issue and posting the fix. The fix looks 
good with the new test added but it hides a latent bug in 
ChunkGroupInputStream#read(). I propose to fix it there like below, let me know 
your thoughts. 

{code}

 

*--- 
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java*

*+++ 
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java*

@@ -122,12 +122,8 @@ public synchronized int read(byte[] b, int off, int len) 
throws IOException {

         return totalReadLen > 0 ? totalReadLen : EOF;

       }

       totalReadLen += actualLen;

-      // this means there is no more data to read beyond this point, return

-      if (actualLen != readLen) {

-        return totalReadLen;

-      }

-      off += readLen;

-      len -= readLen;

+      off += actualLen;

+      len -= actualLen;

       if (current.getRemaining() <= 0) {

         currentStreamIndex += 1;

       }

{code}

> ChunkInputStream bulk read api does not read from all the chunks
> ----------------------------------------------------------------
>
>                 Key: HDDS-419
>                 URL: https://issues.apache.org/jira/browse/HDDS-419
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: Ozone Client
>    Affects Versions: 0.2.1
>            Reporter: Mukul Kumar Singh
>            Assignee: Mukul Kumar Singh
>            Priority: Blocker
>             Fix For: 0.2.1
>
>         Attachments: HDDS-419.001.patch
>
>
> After enabling of bulk reads with HDDS-408, testDataValidate started failing 
> because the bulk read api does not read all the chunks from the block.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to