Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[s3] S3Client could not estimate read perfomance correctly (#994) #1010

Merged
merged 1 commit into from
Sep 7, 2017

Conversation

bosher
Copy link
Contributor

@bosher bosher commented Aug 16, 2017

The S3Client does not read the whole object.

The problem is in the call "objectData.read(inputStreamToByte, 0, sizeOfFile)" inside readFromStorage method. This call is returning only the beginning of the object if the object is long enough.

@risdenk
Copy link
Collaborator

risdenk commented Aug 17, 2017

I think this might be able to be simplified further with IOUtils from the aws dependency already.

...
import com.amazonaws.util.IOUtils;
...
// writing the stream to bytes and to results
result.put(key, new ByteArrayByteIterator(IOUtils.toByteArray(objectData)));
objectData.close();
...

This removes the need for manually building the bytearray anyway.

@busbey
Copy link
Collaborator

busbey commented Sep 7, 2017

@risdenk you okay with that as a follow-on, or want to see it here?

@risdenk
Copy link
Collaborator

risdenk commented Sep 7, 2017

@busbey either way works for me.

@busbey busbey merged commit a9f5c04 into brianfrankcooper:master Sep 7, 2017
@manolama manolama mentioned this pull request Sep 26, 2017
@busbey busbey mentioned this pull request May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants