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

Thomas Marquardt commented on HADOOP-14722:
-------------------------------------------

Let me also add the following responses to Esfandiar's feedback:

>>> BlockBlobInputStream.java: L92-94: streamPosition - streamBufferLength + 
>>> streamBufferPosition, can this become negative?  

It cannot be negative.

>>> BlockBlobInputStream.java: L133: don't we need to nullify streamBuffer too?

The buffer is reusable, to avoid frequent memory allocations of a large buffer. 
 I added a resetStreamBuffer function to set the position and length to zero, 
to help clarify.

>>> BlockBlobInputStream.java: L321-323: Why dont you throw the exception right 
>>> at the beginning? 

A goal of this change was to keep the existing blob input stream functionality 
up until a reverse seek operation is performed, at which point it switches to 
the new behavior.  The exception was not thrown at the beginning to reduce the 
likelihood of regression.

>>> BlockBlobInputStream.java: L314: Overall I am not a big fan of having 
>>> nested if and elses because its making code more complicated that needed. 
>>> lets just return instead of creating else.

I agree, although for this bug fix it is desirable to minimize the code change.

>>> BlockBlobInputStream.java: L330: I'd suggest create a private method which 
>>> clears the buffer and get rid of all the custom streamBufferPosition = 0; 
>>> streamBufferLength = 0 and etc.

I added the resetStreamBuffer function for this.  See my earlier comment about 
re-using the buffer.

> Azure: BlockBlobInputStream position incorrect after seek
> ---------------------------------------------------------
>
>                 Key: HADOOP-14722
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14722
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs/azure
>            Reporter: Thomas Marquardt
>            Assignee: Thomas Marquardt
>         Attachments: HADOOP-14722-001.patch, HADOOP-14722-002.patch, 
> HADOOP-14722-003.patch
>
>
> The seek, skip, and getPos methods of BlockBlobInputStream do not correctly 
> account for the stream's  internal buffer.  This results in invalid stream 
> positions. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to